我在wintersmith layout.pug中有下面一行
...
head
meta(name='description' content=locals.description)
...我知道我可以在我的article.pug模板中添加head块,如下所示:
...
block append head
meta(name='author' content=#{page.meta.author})
...但是现在我有两次description元头:
<meta name="description" content="The thing from config.json.">
<meta name="description" content="The thing from the individual article.">wintersmith中的wintersmith中有替代标签的方法吗?我希望避免在我的每个模板中手动添加元标记。
发布于 2021-12-20 12:37:53
事实证明,您可以在模板中替换块。你只要叫他们名字就行了。
所以,我的layout.pug应该是这样的:
..。
. block =‘description’content=locals.description.
在我的article.pug模板中,我可以替换这个块:
// top-level
block metadesc
(meta name='description' content=article.title)我回答这个问题而不是删除,因为我知道明年我会忘记这一点:)
https://stackoverflow.com/questions/70421564
复制相似问题