How to add the author name?


#1

I also want to add the author name to the posts.

What should I do for that?


#2

should be pretty easy, just add front matter to the post - author: Bob Smith and then in the layout you can do {{page.author}} you could also test to see if it exists by doing an if:

{% if page.author %}Written by: {{page.author}}{% endif %}


#3

Will this code work?

{% if page.author %}
  {% include author/{{page.author}}.html %}
{% endif %}

If we have lots of authors and we want to include a file specific to the author name.

AND

If we add the author: -name-, then will it also show up in the RSS feed?


#4

That should work. You could also do the following:

---
author: 'Author Name'
---

{% include author-bio.html name: page.author %}

Then you could deal with the logic inside the partial