Jekyll-无法获取url和作者的姓名

Jekyll-无法获取url和作者的姓名,jekyll,liquid,Jekyll,Liquid,我正试图用以下代码获取作者详细信息以显示在他们的博客附近 {% assign author = site.authors | where: 'name', post.author %} {% if author %} - <a href="{{ author.url }}">{{ author.name }}</a> {% endif %} 任何帮助都将不胜感激 {% assign author = site.authors | where: 'name', post.

我正试图用以下代码获取作者详细信息以显示在他们的博客附近

{% assign author = site.authors | where: 'name', post.author %}
{% if author %}
- <a href="{{ author.url }}">{{ author.name }}</a>
{% endif %}
任何帮助都将不胜感激

{% assign author = site.authors | where: 'name', post.author %}
这将返回一个包含匹配元素的数组,如果找不到匹配元素,则返回nil

如果匹配元素应该存在并且是唯一的,您可以使用如下数组过滤器获得它:

{% assign author = site.authors | where: 'name', post.author | first %}
{% assign author = site.authors | where: 'name', post.author | first %}