{"id":15789861,"url":"https://github.com/rukbotto/jekyll-index-pages","last_synced_at":"2025-03-14T13:30:33.615Z","repository":{"id":56878620,"uuid":"82196600","full_name":"rukbotto/jekyll-index-pages","owner":"rukbotto","description":"Index page generator for Jekyll sites.","archived":false,"fork":false,"pushed_at":"2018-08-05T01:10:51.000Z","size":76,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-05T22:03:56.316Z","etag":null,"topics":["jekyll","ruby"],"latest_commit_sha":null,"homepage":"","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/rukbotto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-16T15:41:53.000Z","updated_at":"2023-11-05T04:15:07.000Z","dependencies_parsed_at":"2022-08-20T23:10:19.504Z","dependency_job_id":null,"html_url":"https://github.com/rukbotto/jekyll-index-pages","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukbotto%2Fjekyll-index-pages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukbotto%2Fjekyll-index-pages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukbotto%2Fjekyll-index-pages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rukbotto%2Fjekyll-index-pages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rukbotto","download_url":"https://codeload.github.com/rukbotto/jekyll-index-pages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243584028,"owners_count":20314682,"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":["jekyll","ruby"],"created_at":"2024-10-04T22:04:00.001Z","updated_at":"2025-03-14T13:30:32.977Z","avatar_url":"https://github.com/rukbotto.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jekyll Index Pages\n\n[![Build Status](https://travis-ci.org/rukbotto/jekyll-index-pages.svg?branch=master)](https://travis-ci.org/rukbotto/jekyll-index-pages)\n\nIndex page generator for Jekyll sites. Generates paginated index pages for blog posts, categories and tags. It can also generate a paginated yearly archive, author and collection pages.\n\n## Installation\n\nAdd this line to your Gemfile:\n\n```ruby\ngem \"jekyll-index-pages\"\n```\n\nAnd then execute:\n\n```sh\n$ bundle\n```\n\nOr install it yourself as:\n\n```sh\n$ gem install jekyll-index-pages\n```\n\nFinally add this line to `gems` setting in your `_config.yml` file:\n\n```yaml\ngems:\n  - jekyll-index-pages\n```\n\n## Usage\n\n### Configuring the plugin\n\nIf you want to generate index pages for your blog posts, you can add the following settings to your `_config.yml` file:\n\n```yaml\nindex_pages:\n  posts:\n    title: Post Listing Page Title\n    excerpt: Post listing page excerpt\n    per_page: 20\n    permalink: /blog/\n    layout: blog\n```\n\nThis will tell the plugin to generate index pages with given title and excerpt, using the layout named `_layouts/blog.html`. Each index page will contain up to 20 documents. First page can be accessed at `/blog/`. Subsequent pages can be accessed at `/blog/\u003cpage-num\u003e/`.\n\n\u003e Documents are sorted automatically using document's `date` setting, the first being the most recent.\n\nIf you want to generate index pages for categories, add the `categories` setting to `index_page` section:\n\n```yaml\nindex_pages:\n  categories:\n    ...\n```\n\nThe same reasoning applies if you want to generate index pages for tags:\n\n```yaml\nindex_pages:\n  tags:\n    ...\n```\n\nYearly archive:\n\n```yaml\nindex_pages:\n  archive:\n    ...\n```\n\nAnd author pages:\n\n```yaml\nindex_pages:\n  authors:\n    ...\n```\n\nFor collection index pages, you need to include the collection name:\n\n```yaml\nindex_pages:\n  custom_name:\n    collection: collection_name\n    ...\n```\n\nDefault values for each setting are:\n\n```yaml\ntitle: :label\nexcerpt: :label\nper_page: 10\npermalink: /:label/\n```\n\nFor categories and tags, `:label` variable refers to the category or tag name.  For posts, `:label` will always be equal to `posts`. For the archive, `:label` refers to any given year. For authors, `:label` is the author name. `:label` value is slugified when composing the permalink.\n\n\u003e Note there is no default value for layout. You must always specify this setting otherwise pages will be generated blank, with no markup.\n\nBecause this plugin [transliterates](http://stackoverflow.com/a/20586777) the URL for generated pages, you need to define a language as follows:\n\n```yaml\nlang: en-US\n```\n\nThen get the specified locale file from \u003chttps://github.com/svenfuchs/rails-i18n/tree/master/rails/locale\u003e and add it to the `_locales/` directory inside your site codebase.\n\n### Including custom data into templates\n\nTo include custom data in the template, you must define a variable in the configuration under the `data` section:\n\n```yaml\nindex_pages:\n  posts:\n    layout: blog\n    data:\n      custom: This is a custom data item\n```\n\nIn this case, you can print the contents of the `custom` variable in the `_layouts/blog.html` layout like this:\n\n```liquid\n{{ page.custom }}\n```\n\n### Including documents and pagination into templates\n\nTo include the paginated documents in your layouts, you can use the `pager` variable as demonstrated next:\n\n```liquid\n{% assign pager = page.pager %}\n\n{% for doc in pager.docs %}\n  \u003ch2\u003e{{ doc.title }}\u003c/h2\u003e\n  {{ doc.excerpt }}\n  \u003ca href=\"{{ doc.url }}\"\u003eRead more...\u003c/a\u003e\n{% endfor %}\n```\n\nEach document in `pager.docs` is a Jekyll document, so you can access all its variables as normally do when developing a layout.\n\nTo include the pagination, you can do the following:\n\n```liquid\n{% assign pager = page.pager %}\n\n{% if pager.total_pages \u003e 1 %}\n  {% if pager.prev_page \u003e 0 %}\n  \u003ca href=\"{{ pager.prev_page_url }}\"\u003ePrev. page\u003c/a\u003e\n  {% endif %}\n  \u003cspan\u003ePage {{ pager.current_page }} of {{ pager.total_pages }}\u003c/span\u003e\n  {% if pager.next_page \u003e 0 %}\n  \u003ca href=\"{{ pager.next_page_url }}\"\u003eNext page\u003c/a\u003e\n  {% endif %}\n{% endif %}\n```\n\n### Linking index pages\n\nSometimes you will need to link index pages, for example when building some kind of category navigation. For this particular use case, you can use `{% category_url %}`, `{% tag_url %}`, `{% author_url %}` and `{% archive_url %}` tags for getting the correct URL to a given index page.\n\n```liquid\n\u003ca href=\"{% category_url \"Category name\" %}\"\u003eCategory name\u003c/a\u003e\n\u003ca href=\"{% tag_url \"Tag name\" %}\"\u003eTag name\u003c/a\u003e\n\u003ca href=\"{% author_url \"Author Name\" %}\"\u003eAuthor Name\u003c/a\u003e\n\u003ca href=\"{% archive_url \"2001\" %}\"\u003e2001\u003c/a\u003e\n```\n\nYou can pass the argument directly as a string or as a variable.\n\nThe following example demonstrates how to create a basic category navigation:\n\n```liquid\n\u003cul\u003e\n  {% for category in site.categories %}\n    \u003cli\u003e\u003ca href=\"{% category_url category[0] %}\"\u003e{{ category[0] }}\u003c/a\u003e\u003c/li\u003e\n  {% endfor%}\n\u003c/ul\u003e\n```\n\n## Development\n\nAfter checking out the repo, run `script/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `script/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at \u003chttps://github.com/rukbotto/jekyll-index-pages.\u003e\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukbotto%2Fjekyll-index-pages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frukbotto%2Fjekyll-index-pages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frukbotto%2Fjekyll-index-pages/lists"}