Jekyll 中的作者存档页面
我正在尝试在 Github 页面上使用 Jekyll 创建一个多作者博客。我将作者数组字段添加到 _config.yml
中,我可以在帖子模板上使用该数据。
_config.yml:
authors:
muratcorlu:
display_name: Murat Corlu
avatar: 2906955ae59c795275979d3782d7bfca
posts.html
{% assign author = site.authors[page.author] %}
<p>Author: {{ author.display_name }}</p>
现在我想制作一个作者存档页面,其网址如 /authors/muratcorlu/
(即列出帖子作者:muratcorlu),但我不知道如何从网址获取作者姓名。
I'm trying to make a multiple author blog with Jekyll on Github pages. I added authors array field to _config.yml
and I can use that data on posts template.
_config.yml:
authors:
muratcorlu:
display_name: Murat Corlu
avatar: 2906955ae59c795275979d3782d7bfca
posts.html
{% assign author = site.authors[page.author] %}
<p>Author: {{ author.display_name }}</p>
Now I want to make an author archive page with a url like /authors/muratcorlu/
(i.e. listing posts authored by muratcorlu), but I don't know how can I get author name from url.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕您无法自动创建这些页面。如果您有 5 位作者,则必须手动创建 5 个页面。页面可以使用相同的布局,这样就不会很痛苦。
这将是authors/muratcorlu.textile
您必须手动创建其中每一个。幸运的是,您不必执行任何其他操作 - 其余部分可以放入共享布局中,如下所示:
I'm afraid you can't create those pages automatically. If you have 5 authors, you will have to create 5 pages manually. The pages can use the same layout, so it will not be very painful.
This would be authors/muratcorlu.textile
You would have to create each of those manually. Fortunately, you don't have to do anything else - the rest can be put in a shared layout that can look like this: