diff --git a/example/_data/authors.yml b/example/_data/authors.yml index 9cb8c6a..490565f 100644 --- a/example/_data/authors.yml +++ b/example/_data/authors.yml @@ -17,7 +17,7 @@ janedoe: test1: exclude: true # testing the exclude attribute name: "test1" - bio: "Test is a demo author 1" + bio: "This is demo author 1" email: "test1@test.com" socials: github: "test1" @@ -26,8 +26,17 @@ test1: # test2 is excluded via exclude attribute for authors autopage config in _config.yml test2: name: "test2" - bio: "Test is a demo author 2" + bio: "This is demo author 2" email: "test2@test.com" socials: github: "test2" twitter: "test2" + +# test3 is not excluded so will get rendered but with a "No posts yet." message +test3: + name: "test3" + bio: "This is demo author 3" + email: "test3@test.com" + socials: + github: "test3" + twitter: "test3" diff --git a/example/_layouts/author.html b/example/_layouts/author.html index e1a36da..9e251c1 100644 --- a/example/_layouts/author.html +++ b/example/_layouts/author.html @@ -8,15 +8,16 @@

{{ author.name }}

{{ author.bio }}

{% assign links = author.socials %} -Twitter -GitHub +Twitter +GitHub

-

{{ page.title }}

- {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%} +{% assign arrSize = paginator.posts | size %} +{% if arrSize > 0 %} +

{{ page.title }}

{% for post in paginator.posts %} {% endfor %} +{% else %} +

No posts yet.

+{% endif %} {% if paginator.total_pages > 1 %}
diff --git a/example/_posts/janedoe/2023-03-31-jane-eight.md b/example/_posts/janedoe/2023-03-31-jane-eight.md index c924147..0238198 100644 --- a/example/_posts/janedoe/2023-03-31-jane-eight.md +++ b/example/_posts/janedoe/2023-03-31-jane-eight.md @@ -1,7 +1,7 @@ --- layout: post title: "Jane Doe #8" -date: 2023-03-30 09:07:12 +0530 +date: 2023-03-30 10:07:12 +0530 author: janedoe --- diff --git a/example/_posts/janedoe/2023-03-31-jane-four.md b/example/_posts/janedoe/2023-03-31-jane-four.md index de77687..a37a9f0 100644 --- a/example/_posts/janedoe/2023-03-31-jane-four.md +++ b/example/_posts/janedoe/2023-03-31-jane-four.md @@ -1,7 +1,7 @@ --- layout: post title: "Jane Doe #4" -date: 2023-03-28 09:07:12 +0530 +date: 2023-03-28 10:07:12 +0530 author: janedoe --- diff --git a/example/_posts/janedoe/2023-03-31-jane-six.md b/example/_posts/janedoe/2023-03-31-jane-six.md index c86b22b..c16f29f 100644 --- a/example/_posts/janedoe/2023-03-31-jane-six.md +++ b/example/_posts/janedoe/2023-03-31-jane-six.md @@ -1,7 +1,7 @@ --- layout: post title: "Jane Doe #6" -date: 2023-03-29 09:07:12 +0530 +date: 2023-03-29 10:07:12 +0530 author: janedoe --- diff --git a/example/_posts/janedoe/2023-03-31-jane-two.md b/example/_posts/janedoe/2023-03-31-jane-two.md index 85dfb13..bad70c4 100644 --- a/example/_posts/janedoe/2023-03-31-jane-two.md +++ b/example/_posts/janedoe/2023-03-31-jane-two.md @@ -1,7 +1,7 @@ --- layout: post title: "Jane Doe #2" -date: 2023-03-27 09:07:12 +0530 +date: 2023-03-27 10:07:12 +0530 author: janedoe --- diff --git a/example/_posts/johndoe/2023-03-31-john-six.md b/example/_posts/johndoe/2023-03-31-john-six.md index 50d6619..0b00974 100644 --- a/example/_posts/johndoe/2023-03-31-john-six.md +++ b/example/_posts/johndoe/2023-03-31-john-six.md @@ -1,7 +1,7 @@ --- layout: post title: "John Doe #6" -date: 2023-03-26 09:07:12 +0530 +date: 2023-03-27 09:07:12 +0530 author: johndoe --- diff --git a/example/index.md b/example/index.md index 2240d16..cd35112 100644 --- a/example/index.md +++ b/example/index.md @@ -2,6 +2,11 @@ layout: home --- +[![Gem Version](https://img.shields.io/gem/v/jekyll-auto-authors)][ruby-gems] +[![Gem Total Downloads](https://img.shields.io/gem/dt/jekyll-auto-authors)][ruby-gems] + +[ruby-gems]: https://rubygems.org/gems/jekyll-auto-authors + This example jekyll site has {{ site.data.authors | size }} authors: {% for author in site.data.authors %}{{ author[1].name }}{% if forloop.last != true %}, {% endif %}{% endfor %}. {% for author in site.data.authors %} @@ -9,6 +14,8 @@ This example jekyll site has {{ site.data.authors | size }} authors: {{ author[1].name }} has {{ posts }} posts. {% endfor %} +test1 & test2 have been excluded for automatic author page generation while test3's page is auto generated without having any posts on their name yet. This can be verified by clicking the link on their names above. + The pagination setting in [`_config.yml`](https://github.com/gouravkhunger/jekyll-auto-authors/tree/main/example/_config.yml) is set to 5 posts per page. Hence, the author pages show their respective posts and when the number exceeds the per page limit, a pagination trail is shown for navigation. This is done using the [`jekyll-auto-authors`](https://github.com/gouravkhunger/jekyll-auto-authors) plugin. Please read the [setup article](http://genicsblog.com/gouravkhunger/adding-multiple-authors-to-a-jekyll-blog-got-easier#2-using-my-plugin-jekyll-auto-authors) to learn more.