aydio
aydio

Reputation: 346

How to append a custom string to "title= title" in jade?

I am currently in the process of introducing myself to Jade along with node.js

As I want to avoid redundancy I thought of appending the domain name to the currect title, e.g. Blog | example.com

My Jade template gets the Blog via the Node.js router as title. Now I want to append | example.com to the title but I don't know how to do it when my template looks like this:

!!! 5
html(lang="de")
  head
    meta(charset="utf-8")
    title= title

How do I have to modify the last line so I can append the text?

I hope my question is clear enough.

Upvotes: 5

Views: 4892

Answers (1)

keviv
keviv

Reputation: 131

The below worked for me.

!!! 5
html(lang="de")
  head
    meta(charset="utf-8")
    title= title + " example.com"

If you want to use it in the body with h1 and p tags use this:

body
  h1 #{title} example.com
  p #{title} example.com

Upvotes: 7

Related Questions