parent
b288587c1c
commit
f1d9e99bc0
2 changed files with 22 additions and 16 deletions
|
@ -57,24 +57,24 @@ tail_includes:
|
|||
{% endif %}
|
||||
|
||||
<div class="d-flex justify-content-between">
|
||||
<!-- author -->
|
||||
<!-- author(s) -->
|
||||
<span>
|
||||
{% 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 }}
|
||||
|
||||
<em>
|
||||
{% if author_link %}
|
||||
<a href="{{ author_link }}">{{ author_name }}</a>
|
||||
{% if authors %}
|
||||
{% for author in authors %}
|
||||
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
|
||||
{% unless forloop.last %}</em>, <em>{% endunless %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
{{ author_name }}
|
||||
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>
|
||||
{% endif %}
|
||||
</em>
|
||||
</span>
|
||||
|
|
|
@ -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
|
||||
<author_id>:
|
||||
|
@ -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_id>
|
||||
author: <author_id> # for single entry
|
||||
# or
|
||||
authors: [<author1_id>, <author2_id>] # 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
|
||||
|
|
Loading…
Reference in a new issue