18f.gsa.gov: 自动化署名

创建于 2015-03-19  ·  3评论  ·  资料来源: 18F/18f.gsa.gov

现在博客文章需要以下内容才能获得简单的署名:

# in the frontmatter
authors:
- author1
- author2

并在帖子正文中

<p class="authors">
  by {% author author1 %} and {% author author2 %}
</p>

让我们消除冗余,看看是否可以在帖子模板中自动生成署名。 我们不小心发布了太多没有署名的帖子。

期望状态:
layouts/post.html

<p class="authors">{% authors %}</p>

注意事项:

  • 我们的一些帖子有插图画家
  • 作者可在站点对象中找到:模板中的site.data.authors 。 根据您正在制作的插件类型,有不同的方法可以利用这一点。
  • 可能还有其他 Jekyll 站点已经这样做了; 我是为我的一个副项目做的,但这可能不是最好的模型。
help wanted blog-feature

所有3条评论

我们的一些帖子的作者未在团队数据文件中列出,并包括他们的标题。 我们可以这样设置,如果前文数组中给定的句柄未找到作者,则将其视为要嵌入的纯文本,而不是查找句柄。

好主意, @konklone ,感谢您的建议。 :+1:

很确定这是用#966 完成的,对吧?

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

gboone picture gboone  ·  16评论

gboone picture gboone  ·  4评论

gboone picture gboone  ·  15评论

coreycaitlin picture coreycaitlin  ·  23评论

coreycaitlin picture coreycaitlin  ·  5评论