{"id":13612108,"url":"https://github.com/gouravkhunger/jekyll-auto-authors","last_synced_at":"2025-04-13T16:41:04.262Z","repository":{"id":41962772,"uuid":"473577185","full_name":"gouravkhunger/jekyll-auto-authors","owner":"gouravkhunger","description":"Plugin that simplifies adding multiple authors support to Jekyll powered blogs. Solves the 12 year old problem with managing multiple authors in jekyll blogs and publications.","archived":false,"fork":false,"pushed_at":"2023-05-14T03:38:58.000Z","size":97,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-03-14T19:05:32.592Z","etag":null,"topics":["authors","autopager","hacktoberfest","jekyll","jekyll-paginate","jekyll-plugin","paginate","pagination","pagination-gem","plugin","ruby"],"latest_commit_sha":null,"homepage":"http://auto-authors.gourav.sh/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gouravkhunger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2022-03-24T11:29:29.000Z","updated_at":"2024-01-24T11:00:33.000Z","dependencies_parsed_at":"2024-01-14T04:49:04.759Z","dependency_job_id":"92b9fd50-8164-4955-bc27-2b50b8b54bd0","html_url":"https://github.com/gouravkhunger/jekyll-auto-authors","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"2c95fdfbcb87e1d68f923d1672102b66bc601d2a"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-auto-authors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-auto-authors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-auto-authors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-auto-authors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gouravkhunger","download_url":"https://codeload.github.com/gouravkhunger/jekyll-auto-authors/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248746953,"owners_count":21155357,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authors","autopager","hacktoberfest","jekyll","jekyll-paginate","jekyll-plugin","paginate","pagination","pagination-gem","plugin","ruby"],"created_at":"2024-08-01T20:00:22.602Z","updated_at":"2025-04-13T16:41:04.255Z","avatar_url":"https://github.com/gouravkhunger.png","language":"Ruby","funding_links":["https://paypal.me/gouravkhunger)!"],"categories":["Pagination"],"sub_categories":[],"readme":"# Jekyll::AutoAuthors\n\n[![Gem Version](https://img.shields.io/gem/v/jekyll-auto-authors)][ruby-gems]\n[![Gem Total Downloads](https://img.shields.io/gem/dt/jekyll-auto-authors)][ruby-gems]\n\n[ruby-gems]: https://rubygems.org/gems/jekyll-auto-authors\n\nThis plugin integrates with the `jekyll-paginate-v2` gem to provide seamless multiple authors support for jekyll powered publications.\n\nSupporting multiple authors inside a jekyll plugin has been a challenge from long. Here are some references to the issue dating to a long time ago:\n\n- [Author archive pages in Jekyll](https://stackoverflow.com/q/9027527/9819031)\n- [Trying to generate author pages in Jekyll plugin for pagination](https://stackoverflow.com/q/23439944/9819031)\n- [How to paginate posts by author](https://stackoverflow.com/q/51744240/9819031)\n\nI faced similar problems while managing multiple authors at [Genics Blog](https://genicsblog.com), so I came up with this plugin that solves the problem!\n\n## When to use it?\n\nIf you want to achieve any of the following:\n\n- Automatically generate author pages that list an author's details.\n  \n  The details can be anything, like name, bio, portfolio website, social media links, etc.\n\n- Show a list of posts by that author.\n\n  The posts must be paginated. This means if there are a lot of posts, we want to show next and previous buttons for navigation.\n\n- The pages should be generated even if the author has no posts written.\n- You just want to drop in a `author: username` to the frontmatter of post and it should add the post to the author's page with the least required configuration.\n- Adding new authors should not require restarting the jekyll server.\n\nThe plugin does exactly that!\n\n## Installation\n\nAdd this line to your application's Gemfile inside the `jekyll_plugins` group:\n\n```ruby\ngroup :jekyll_plugins do\n    # other gems\n    gem \"jekyll-paginate-v2\"\n    gem \"jekyll-auto-authors\"\nend\n```\n\nThen, enable the plugin by adding it to the plugins section in the `_config.yml` file:\n\n```yml\nplugins:\n    # - other plugins\n    - jekyll-paginate-v2\n    - jekyll-auto-authors\n```\n\nAnd then execute:\n\n    $ bundle install\n\n**Note**: This project depends on utilities inside the [`jekyll-paginate-v2`](https://github.com/sverrirs/jekyll-paginate-v2) plugin to override the autopage and pagination behaviour. Please make sure to install and enable it first.\n\n## Usage\n\nThis plugin fits well inside the configuration for `jekyll-paginate-v2` plugin.\n\nFirst, you need to set pagination configuration inside `_config.yml` file. This is similar to what the pagination plugin requires.\n\n```yml\npagination:\n  enabled: true\n  per_page: 9\n  permalink: '/page/:num/'\n  title: ':title - page :num'\n  sort_field: 'date'\n  sort_reverse: true\n```\n\nThis configuration will be used for pagination on the generated author pages. The above example defines that each page should get 9 posts at max. The permalink of first page is same, but the later pages get `/page/:num` appended to it. `:num` gets converted to the page number.\n\nTo learn more about the pagination setup, please refer to the [pagionation guide](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-GENERATOR.md) of `jekyll-paginate-v2` plugin.\n\nNow we'll define the autopages config. `jekyll-paginate-v2` has built-in autopage support for tags, categories and collections. [Read more on Autopages](https://github.com/sverrirs/jekyll-paginate-v2/blob/master/README-AUTOPAGES.md).\n\nBut it doesn't support autopages for authors. Adding the `jekyll-auto-authors` plugin makes it possible!\n\nDefine an `autopages` block to set up author autopages:\n\n```yml\nautopages:\n\n  # Other autopage configs stay the same\n  enabled: true\n\n  categories:\n    enabled: false\n  tags:\n    enabled: false\n  collections:\n    enabled: false\n\n  # Add this block\n  authors:\n    enabled: true\n    data: '_data/authors.yml' # Data file with the author info (optional, but recommended). More on this later.\n    # Uncomment the line below to force exclude certain author usernames from autopage generation.\n    # exclude: [ \"author1\", \"author2\" ]\n    layouts: \n      - 'author.html' # We'll define this layout in the next step.\n    title: 'Posts by :author'\n    permalink: '/author/:author/'\n    slugify:\n      mode: 'default' # choose from [raw, default, pretty, ascii or latin]\n      cased: true # if true, the uppercase letters in slug will be converted to lowercase ones.\n```\n\nThat's it for the autopages and pagination configuration.\n\n## Template\n\nFor each author that the plugin discovers in your posts, it will generate a page using the `layouts` defined in the config.\n\nLet's see a basic layout called `author.html` so you get a gist of how to render posts for the author:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\n\u003c!--\n  page.pagination.author stores the username of the currently-being-rendered author.\n  The one that you set with \"author: name\" in front-matter.\n--\u003e\n{% assign author_username = page.pagination.author %}\n\n  \u003cbody\u003e\n    \u003ch1\u003ePosts by {{ author_username }}\u003c/h1\u003e\n\n    \u003c!--\n      The main logic for rendering an author's posts resides here.\n      The plugin exposes a paginator object that you can use to loop through the post.\n      It handles all the pagination logic for you.\n    --\u003e\n    {% assign numPosts = paginator.posts | size %}\n    {% if numPosts \u003e 0 %}\n      {% for post in paginator.posts %}\n        {% include postbox.html %}\n      {% endfor %}\n    {% else %}\n    \u003cp\u003eNo posts yet.\u003c/p\u003e\n    {% endif %}\n\n    \u003c!--\n      If there are more pages available for the current author's posts, show\n      \"Previous\" / \"Next\" links for navigation.\n    --\u003e\n    {% if paginator.total_pages \u003e 1 %}\n    \u003cul\u003e\n      {% if paginator.previous_page %}\n      \u003cli\u003e\n        \u003ca href=\"{{ paginator.previous_page_path | prepend: site.baseurl }}\"\u003ePrevious\u003c/a\u003e\n      \u003c/li\u003e\n      {% endif %}\n\n      {% if paginator.next_page %}\n      \u003cli\u003e\n        \u003ca href=\"{{ paginator.next_page_path | prepend: site.baseurl }}\"\u003eNext\u003c/a\u003e\n      \u003c/li\u003e\n      {% endif %}\n    \u003c/ul\u003e\n    {% endif %}\n  \u003c/body\u003e\n\n\u003c/html\u003e\n```\n\nThat's it for the prehand configuration!\n\nNow, you can go to any post and just drop in the username to the frontmatter of the post.\n\n```yml\n---\n# other configs\nauthor: username2\n---\n\nA random post.\n```\n\nOnce you run the build, you'll see the author page for `username2` come inside the `_site/author/username2/` directory. If there are a lot of posts by username2, it will generate pagination pages as defined in the `pagination` block of `_config.yml` file.\n\n### Author data (optional)\n\nYou might want to render additional details for each author other than the username. Also, you might want to generate a page for an author who hasn't yet written an article.\n\nBoth of these requirements can be achieved by defining a data file for the authors.\n\nFor an example, let's take a minimal `_data/authors.yml` file. Usernames should be defined at the top level. Other than that, the plugin provides you the flexibility to define the data as you want to.\n\n```yml\nusername1:\n  name: 'User 1'\n  bio: 'Bio of user 1'\n  website: 'http://user1.com'\n  socials:\n    twitter: '@user1'\n    github: 'user1'\n\nusername2:\n  name: 'User 2'\n  bio: 'Bio of user 2'\n  website: 'http://user2.com'\n  socials:\n    twitter: '@user2'\n    github: 'user2'\n\ntest:\n  exclude: true # Skips author page from generation only if they have no post assigned.\n  name: 'Test user'\n  bio: 'Bio of test user'\n  website: 'http://test.com'\n  socials:\n    twitter: '@test'\n    github: 'test'\n\n# and so on, adding new usernames will create a page for them even if they have no posts!\n```\n\nThe only reserved keyword here is `exclude`. All authors defined in the data file will have a page rendered for them unless they are excluded by `exclude` in their data - which is a soft exclude that works only when they have no post assigned, or from `_config.yml` - which performs a force exclude.\n\nOnce you define the usernames, all the data for an author is passed on to the liquid template inside `page.pagination.author_data` variable so you can render it as you wish!\n\nHere's the updated template showcasing the use of the author data:\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\n\u003c!-- This has the username of author. The one that you set with \"author: name\" in front-matter--\u003e\n{% assign author_username = page.pagination.author %}\n\n\u003c!-- Use page.pagination.author_data only if you have data file setup correctly --\u003e\n{% assign author = page.pagination.author_data %}\n\u003c!--\n  Now you can use the author variable anyhow.\n  It has all the data as defined inside _data/authors.yml for the current username.\n--\u003e\n\n  \u003chead\u003e\n    \u003c!-- See how we can use values inside the author variable. --\u003e\n    \u003cmeta name=\"description\" content=\"{{ author.bio }}\"\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    \u003ch1\u003e{{ author.name }}\u003c/h1\u003e\n    \u003cp\u003e{{ author.bio }}\u003c/p\u003e\n    \u003ca href=\"{{ author.website }}\"\u003ePortfolio\u003c/a\u003e\n    {% assign links = author.socials %}\n    \u003ca href=\"{{ links.twitter }}\"\u003eTwitter\u003c/a\u003e\n    \u003ca href=\"{{ links.github }}\"\u003eGitHub\u003c/a\u003e\n\n    \u003c!-- Rest of the functionality remains the same --\u003e\n  \u003c/body\u003e\n\n\u003c/html\u003e\n```\n\n## How does it work?\n\nThe `jekyll-paginate-v2` plugin does a great job at paginating tags, categories and collections. But it doesn't include support for author pagination and autopages. And the project hasn't received much of updates lately, and the existing issues and PRs are stale because of which I decided to make an extension plugin for it.\n\nThis plugin uses the utilty classes and functions from the `jekyll-paginate-v2` plugin to add custom logic for author page generation.\n\nWhen you run the site, the plugin will go through the unique authors in the site, generating an initial temporary author page for them. Then it loops through the generated author pages and processes the page for pagination. Simultaneously, it also passes the author data from the data file to the page to render the author details.\n\nOnce the pagination pages are generated, they are written to the `_site` folder with the permalink structure you define.\n\n## Side notes\n\nThe beauty of using a data file to store authors is that changes in data are reflected without restarting the jekyll server, unlike the `_config.yml` file.\n\nMoreover, all the authors are available in the `site.data.authors` variable, so you can loop through them and show a list of all authors on the homepage or any other page.\n\n```html\n{% for author in site.data.authors %}\n  \u003ca href=\"{{ site.baseurl }}/author/{{ author[0] }}\"\u003e\n    \u003cspan\u003e{{ author.name }}\u003c/span\u003e\n  \u003c/a\u003e\n  \u003cp\u003e{{ author.bio }}\u003c/p\u003e\n{% endfor %}\n```\n\nAlso, a specific author's data can be reused in the post template:\n\n```html\n{% assign author = page.author %}\n{% assign author_data = site.data.authors[author] %}\n\u003ca href=\"{{ site.baseurl }}/author/{{ author }}\"\u003e\n  \u003cspan\u003e{{ author_data.name }}\u003c/span\u003e\n\u003c/a\u003e\n\u003cp\u003e{{ author_data.bio }}\u003c/p\u003e\n```\n\n## Need some inspiration?\n\nWe are using this plugin to generate the author pages at [Genics Blog](https://genicsblog.com). Have a look at our [`_config.yml`](https://github.com/genicsblog/theme-files/blob/main/_config.yml) file to see how it works.\n\n## The Author\n\nI am a self-taught software developer from India! I am a passionate app developer working on a lot of different kind of projects. If you like this plugin, let me know by supporting me!\n\nThe easiest no-brainer way would be to :star2: this plugin by pressing the button on the top right of this page, and [follow me](https://github.com/gouravkhunger) on GitHub. Or consider [buying me a coffee](https://paypal.me/gouravkhunger)!\n\nI write frequent programming related content on [Genics Blog](https://genicsblog.com/author/gouravkhunger/). You can contact me through [our Discord server](https://discord.genicsblog.com).\n\n## Contributing\n\n[Bug reports](https://github.com/gouravkhunger/jekyll-auto-authors/issues) and [pull requests](https://github.com/gouravkhunger/jekyll-auto-authors/pulls) are welcome on GitHub. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/gouravkhunger/jekyll-auto-authors/blob/main/CODE_OF_CONDUCT.md).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://github.com/gouravkhunger/jekyll-auto-authors/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgouravkhunger%2Fjekyll-auto-authors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgouravkhunger%2Fjekyll-auto-authors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgouravkhunger%2Fjekyll-auto-authors/lists"}