diff --git a/_layouts/post.html b/_layouts/post.html index 255832cece8..e3d922c29e5 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -57,25 +57,25 @@

{{ page.title }}

{% endif %}
- + - {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} - {% assign author_link = nil %} - {% if page.author %} - {% assign author_link = site.data.authors[page.author].url %} - {% elsif author_name == site.social.name %} - {% assign author_link = site.social.links[0] %} + {% assign authors = page.author %} + {% elsif page.authors %} + {% assign authors = page.authors %} {% endif %} {{ site.data.locales[lang].post.written_by }} - {% if author_link %} - {{ author_name }} - {% else %} - {{ author_name }} - {% endif %} + {% if authors %} + {% for author in authors %} + {{ site.data.authors[author].name }} + {% unless forloop.last %}, {% endunless %} + {% endfor %} + {% else %} + {{ site.social.name }} + {% endif %} diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index d40c3eb3853..acea436e04d 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -48,7 +48,7 @@ tags: [bee] The author information of the post usually does not need to be filled in the _Front Matter_ , they will be obtained from variables `social.name` and the first entry of `social.links` of the configuration file by default. But you can also override it as follows: -Add author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one.) +Adding author information in `_data/authors.yml` (If your website doesn't have this file, don't hesitate to create one). ```yaml : @@ -58,15 +58,21 @@ Add author information in `_data/authors.yml` (If your website doesn't have this ``` {: file="_data/authors.yml" } -And then set up the custom author in the post's YAML block: + +And then use `author` to specify a single entry or `authors` to specify multiple entries: ```yaml --- -author: +author: # for single entry +# or +authors: [, ] # for multiple entries --- ``` -> Another benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO. + +Having said that, the key `author` can also identify multiple entries. + +> The benefit of reading the author information from the file `_data/authors.yml`{: .filepath } is that the page will have the meta tag `twitter:creator`, which enriches the [Twitter Cards](https://developer.twitter.com/en/docs/twitter-for-websites/cards/guides/getting-started#card-and-content-attribution) and is good for SEO. {: .prompt-info } ## Table of Contents