0

I have the following line in the wintersmith layout.pug:

...  
head
  meta(name='description' content=locals.description)
...

I know I can add to the head block in my article.pug template, something like this:

...
block append head
  meta(name='author' content=#{page.meta.author})
...

But now I have the description meta header twice:

<meta name="description" content="The thing from config.json.">
<meta name="description" content="The thing from the individual article.">

Is there a way to replace a tag in pug template in wintersmith? I want to avoid to actually having to manually add meta tags in each of my templates.

Zlatko
  • 18,936
  • 14
  • 70
  • 123

1 Answers1

0

As it turns out, you can replace blocks in a template. You just have to have them named.

So, my layout.pug will look like this:

...
head block metadesc meta(name='description' content=locals.description) ...

And in my article.pug template, I can replace that block:

// top-level
block metadesc
  (meta name='description' content=article.title)

I'm answering the question instead of deleting, because I know I'll forget this for the next year :)

Zlatko
  • 18,936
  • 14
  • 70
  • 123