jekyll-collection-pages 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.devcontainer/devcontainer.json +27 -0
- data/.devcontainer/post-create.sh +17 -0
- data/.github/build.sh +4 -0
- data/.github/bump.sh +28 -0
- data/.github/dependabot.yml +12 -0
- data/.github/pr-labeler.yml +7 -0
- data/.github/release-drafter.yml +40 -0
- data/.github/release.sh +69 -0
- data/.github/test.sh +4 -0
- data/.github/workflows/ci.yml +92 -0
- data/.github/workflows/pr_labeler.yml +16 -0
- data/.github/workflows/release.yml +23 -0
- data/.github/workflows/release_draft.yml +61 -0
- data/.github/workflows/site.yml +91 -0
- data/.gitignore +21 -0
- data/.rubocop.yml +43 -0
- data/.rubocop_todo.yml +33 -0
- data/.ruby-version +1 -0
- data/.vscode/settings.json +5 -0
- data/.vscode/tasks.json +58 -0
- data/CODE_OF_CONDUCT.md +128 -0
- data/CONTRIBUTING.md +41 -0
- data/Gemfile +39 -0
- data/LICENSE +21 -0
- data/README.md +152 -0
- data/Rakefile +8 -0
- data/VERSION +1 -0
- data/demo/CODE_OF_CONDUCT.md +1 -0
- data/demo/_articles/jekyll-collection-pages-comparison.md +90 -0
- data/demo/_articles/jekyll-collection-pages-indices.md +173 -0
- data/demo/_articles/jekyll-for-documentation.md +399 -0
- data/demo/_articles/linking-obsidian-and-jekyll.md +89 -0
- data/demo/_config.yml +83 -0
- data/demo/_docs/configuration-guide.md +113 -0
- data/demo/_docs/examples.md +159 -0
- data/demo/_docs/generated-data.md +76 -0
- data/demo/_docs/layout-recipes.md +122 -0
- data/demo/_docs/quick-start.md +1 -0
- data/demo/_docs/troubleshooting.md +68 -0
- data/demo/_layouts/collection_layout.html +27 -0
- data/demo/_layouts/tags.html +31 -0
- data/demo/articles.md +18 -0
- data/demo/assets/img/articles.png +0 -0
- data/demo/assets/img/docs.png +0 -0
- data/demo/assets/img/jekyll-collection-pages-preview.png +0 -0
- data/demo/assets/img/jekyll-collection-pages.png +0 -0
- data/demo/assets/img/post-img-1.png +0 -0
- data/demo/assets/img/post-img-2.png +0 -0
- data/demo/assets/img/post-img-3.png +0 -0
- data/demo/assets/img/post-img-4.png +0 -0
- data/demo/contributing.md +1 -0
- data/demo/directory.md +36 -0
- data/demo/docs.md +24 -0
- data/demo/gallery.md +14 -0
- data/demo/index.md +63 -0
- data/demo/tags.md +15 -0
- data/jekyll-collection-pages.gemspec +28 -0
- data/lib/jekyll/collection_pages.rb +383 -0
- data/lib/jekyll-collection-pages.rb +4 -0
- metadata +126 -0
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
https://www.allisonthackston.com/contact/.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
data/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributing to jekyll-collection-pages
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to jekyll-collection-pages! We welcome contributions from the community to help improve and grow this project. This document outlines the process for contributing to the repository.
|
|
4
|
+
|
|
5
|
+
## Getting Started
|
|
6
|
+
|
|
7
|
+
1. Fork the repository on GitHub.
|
|
8
|
+
2. Clone your fork locally: `git clone https://github.com/PrimerPages/jekyll-collection-pages.git`
|
|
9
|
+
3. Create a new branch for your feature or bug fix: `git checkout -b feature/your-feature-name` or `git checkout -b fix/your-bug-fix`
|
|
10
|
+
|
|
11
|
+
## Making Changes
|
|
12
|
+
|
|
13
|
+
1. Make your changes in your branch.
|
|
14
|
+
2. Follow the coding style and conventions used in the project.
|
|
15
|
+
3. Add or update tests as necessary.
|
|
16
|
+
4. Ensure all tests pass locally.
|
|
17
|
+
5. Commit your changes with a clear and descriptive commit message.
|
|
18
|
+
|
|
19
|
+
## Submitting a Pull Request
|
|
20
|
+
|
|
21
|
+
1. Push your changes to your fork on GitHub.
|
|
22
|
+
2. Open a pull request from your branch to the main repository's `main` branch.
|
|
23
|
+
3. Provide a clear title and description for your pull request, explaining the changes you've made and why.
|
|
24
|
+
4. Be prepared to address any feedback or questions during the review process.
|
|
25
|
+
|
|
26
|
+
## Reporting Issues
|
|
27
|
+
|
|
28
|
+
If you find a bug or have a suggestion for improvement:
|
|
29
|
+
|
|
30
|
+
1. Check if the issue already exists in the GitHub issue tracker.
|
|
31
|
+
2. If not, create a new issue, providing as much detail as possible, including steps to reproduce for bugs.
|
|
32
|
+
|
|
33
|
+
## Code of Conduct
|
|
34
|
+
|
|
35
|
+
Please note that this project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms.
|
|
36
|
+
|
|
37
|
+
## Questions?
|
|
38
|
+
|
|
39
|
+
If you have any questions or need further clarification, please don't hesitate to ask in the issue tracker or reach out to the maintainers.
|
|
40
|
+
|
|
41
|
+
Thank you for contributing to jekyll-collection-pages!
|
data/Gemfile
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
gem 'jekyll', ENV['JEKYLL_VERSION'] if ENV['JEKYLL_VERSION']
|
|
7
|
+
|
|
8
|
+
gem 'webrick', '~> 1.8'
|
|
9
|
+
|
|
10
|
+
group :jekyll_plugins do
|
|
11
|
+
gem 'jekyll-feed'
|
|
12
|
+
gem 'jekyll-paginate'
|
|
13
|
+
gem 'jekyll-redirect-from'
|
|
14
|
+
gem 'jekyll-relative-links'
|
|
15
|
+
gem 'jekyll-sitemap'
|
|
16
|
+
gem 'jekyll-theme-profile' # needed for themeing
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
group :development do
|
|
20
|
+
gem 'bundler'
|
|
21
|
+
gem 'dotenv'
|
|
22
|
+
gem 'html-proofer'
|
|
23
|
+
gem 'rake'
|
|
24
|
+
gem 'rspec'
|
|
25
|
+
gem 'rubocop', require: false
|
|
26
|
+
gem 'rubocop-rake', require: false
|
|
27
|
+
gem 'rubocop-rspec', require: false
|
|
28
|
+
gem 'ruby-lsp'
|
|
29
|
+
gem 'ruby-lsp-rspec', require: false
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Required in Ruby 3.4+ when Jekyll < 4.4
|
|
33
|
+
gem 'base64'
|
|
34
|
+
gem 'bigdecimal'
|
|
35
|
+
gem 'csv'
|
|
36
|
+
gem 'logger'
|
|
37
|
+
|
|
38
|
+
# Required in Ruby 3.3.4 when Jekyll == 3.10
|
|
39
|
+
gem 'kramdown-parser-gfm'
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Allison Thackston
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Quick start"
|
|
3
|
+
category: "Getting Started"
|
|
4
|
+
description: "Install the plugin, configure your first collection, and explore the generated pages."
|
|
5
|
+
order: 2
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
`jekyll-collection-pages` adds automated index pages, layout selection, and optional pagination for any Jekyll collection. In a few minutes you can stand up front-matter key based landing pages like "tags" or "categories" that stay in sync with your content.
|
|
9
|
+
|
|
10
|
+
## Install the plugin
|
|
11
|
+
|
|
12
|
+
1. Add the gem to your site’s `Gemfile`:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
gem 'jekyll-collection-pages'
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. Enable the plugin in `_config.yml`:
|
|
19
|
+
|
|
20
|
+
```yaml
|
|
21
|
+
plugins:
|
|
22
|
+
- jekyll-collection-pages
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
3. Ensure the collections you plan to index have `output: true` so the generated pages can link to the documents.
|
|
26
|
+
|
|
27
|
+
## Configure your first collection
|
|
28
|
+
|
|
29
|
+
Add a `collection_pages` entry for each collection/field combination you want to index:
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
collections:
|
|
33
|
+
docs:
|
|
34
|
+
output: true
|
|
35
|
+
|
|
36
|
+
collection_pages:
|
|
37
|
+
- collection: docs
|
|
38
|
+
field: category
|
|
39
|
+
path: docs/category
|
|
40
|
+
layout: category_layout.html
|
|
41
|
+
paginate: 6
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Key options:
|
|
45
|
+
- `collection`: collection label (matches `collections` config).
|
|
46
|
+
- `field`: front-matter key to group documents (string or list values).
|
|
47
|
+
- `path`: base folder for generated pages (relative to site root).
|
|
48
|
+
- `layout`: layout in `_layouts/` (defaults to `collection_layout.html`).
|
|
49
|
+
- `paginate`: optional integer for per-page pagination.
|
|
50
|
+
|
|
51
|
+
You can declare multiple entries—single collection with many fields, or multiple collections:
|
|
52
|
+
|
|
53
|
+
```yaml
|
|
54
|
+
collection_pages:
|
|
55
|
+
- collection: docs
|
|
56
|
+
field: category
|
|
57
|
+
path: docs/category
|
|
58
|
+
layout: category_layout.html
|
|
59
|
+
paginate: 6
|
|
60
|
+
- collection: articles
|
|
61
|
+
field: tags
|
|
62
|
+
path: articles/tags
|
|
63
|
+
layout: tags_layout.html
|
|
64
|
+
paginate: 10
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Build and explore
|
|
68
|
+
|
|
69
|
+
Run `bundle exec jekyll serve` and visit the generated paths, e.g. `/docs/category/getting-started/`. The plugin injects these variables into layouts:
|
|
70
|
+
|
|
71
|
+
- `page.tag`: value of the current field.
|
|
72
|
+
- `page.posts`: documents in that field bucket.
|
|
73
|
+
- `page.paginator`: pagination data when `paginate` is set (same shape as Jekyll paginator).
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
{% raw %}
|
|
78
|
+
---
|
|
79
|
+
layout: default
|
|
80
|
+
---
|
|
81
|
+
<h1>{{ page.tag }}</h1>
|
|
82
|
+
<ul>
|
|
83
|
+
{% for doc in page.posts %}
|
|
84
|
+
<li><a href="{{ doc.url | relative_url }}">{{ doc.data.title }}</a></li>
|
|
85
|
+
{% endfor %}
|
|
86
|
+
</ul>
|
|
87
|
+
{% endraw %}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Surface the generated data
|
|
91
|
+
|
|
92
|
+
Every build populates a hash at `site.data.collection_pages[collection][field]` that contains:
|
|
93
|
+
|
|
94
|
+
- `template` → the full sanitized template used for creating pages with placeholders intact. Directory-style values from `_config.yml` are auto-appended with `:field/page:num/index.html`. (e.g. `/docs/category/:field/page:num/index.html`)
|
|
95
|
+
- `permalink` → the sanitized template for the index with placeholders intact (e.g. `/docs/category/:field/`)
|
|
96
|
+
- `pages` → documents grouped by label (`{ label => [documents...] }`)
|
|
97
|
+
- `labels`: metadata describing the generated index pages
|
|
98
|
+
|
|
99
|
+
Iterate through the documents for a field:
|
|
100
|
+
|
|
101
|
+
```liquid
|
|
102
|
+
{% raw %}
|
|
103
|
+
{% assign docs_info = site.data.collection_pages.docs.category %}
|
|
104
|
+
{% for entry in docs_info.pages %}
|
|
105
|
+
{% assign label = entry | first %}
|
|
106
|
+
{% assign documents = entry | last %}
|
|
107
|
+
<h2>{{ label }}</h2>
|
|
108
|
+
<p>{{ documents.size }} docs</p>
|
|
109
|
+
{% endfor %}
|
|
110
|
+
{% endraw %}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Pair the documents with their metadata when you need generated URLs or pagination helpers:
|
|
114
|
+
|
|
115
|
+
```liquid
|
|
116
|
+
{% raw %}
|
|
117
|
+
{%- assign info = site.data.collection_pages.articles.tags %}
|
|
118
|
+
|
|
119
|
+
{% for entry in info.pages %}
|
|
120
|
+
{% assign label = entry | first %}
|
|
121
|
+
{% assign documents = entry | last %}
|
|
122
|
+
{% assign meta = info.labels[label] %}
|
|
123
|
+
<h2> <a href="{{ meta.index.url | relative_url }}">{{ label }}</a> ({{ documents.size }})</h2>
|
|
124
|
+
<ul>
|
|
125
|
+
{% for entry in documents %}
|
|
126
|
+
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
|
|
127
|
+
{% endfor %}
|
|
128
|
+
</ul>
|
|
129
|
+
{% endfor %}
|
|
130
|
+
{% endraw %}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Or create the links to the generated documents by subsituting the path:
|
|
134
|
+
|
|
135
|
+
```liquid
|
|
136
|
+
{% raw %}
|
|
137
|
+
{%- assign info = site.data.collection_pages.articles.tags %}
|
|
138
|
+
{%- assign index_permalink = site.data.collection_pages.articles.tags.permalink %}
|
|
139
|
+
|
|
140
|
+
{% for entry in info.pages %}
|
|
141
|
+
{% assign label = entry | first %}
|
|
142
|
+
{% assign documents = entry | last %}
|
|
143
|
+
{% assign tag_url = index_permalink | replace: ':field', label %}
|
|
144
|
+
<h2> <a href="{{ tag_url | relative_url }}">{{ label }}</a> ({{ documents.size }})</h2>
|
|
145
|
+
<ul>
|
|
146
|
+
{% for entry in documents %}
|
|
147
|
+
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
|
|
148
|
+
{% endfor %}
|
|
149
|
+
</ul>
|
|
150
|
+
{% endfor %}
|
|
151
|
+
{% endraw %}
|
|
152
|
+
```
|
data/Rakefile
ADDED
data/VERSION
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
0.1.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
../CODE_OF_CONDUCT.md
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: post
|
|
3
|
+
title: "Jekyll Collection Pages Comparison"
|
|
4
|
+
date: 2024-08-02
|
|
5
|
+
author: Allison Thackston
|
|
6
|
+
category: Plugin Comparisons
|
|
7
|
+
image: /assets/img/post-img-3.png
|
|
8
|
+
tags: [jekyll, plugins, tagging, categories, collections]
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
When it comes to organizing content in Jekyll, several plugins offer solutions for handling tags and categories. In this article, we'll compare three popular options: `jekyll-collection-pages`, `jekyll-tagging`, and `jekyll-category-pages`. We'll explore their features, use cases, and help you decide which might be the best fit for your project.
|
|
12
|
+
|
|
13
|
+
## jekyll-collection-pages
|
|
14
|
+
|
|
15
|
+
`jekyll-collection-pages` is a versatile plugin that generates pages for tags or categories across multiple collections.
|
|
16
|
+
|
|
17
|
+
### Key Features:
|
|
18
|
+
- Works with any Jekyll collection, not just posts
|
|
19
|
+
- Supports both tags and categories in a single configuration
|
|
20
|
+
- Offers pagination for generated pages
|
|
21
|
+
- Allows custom layouts for different collections
|
|
22
|
+
- Provides flexibility in URL structure
|
|
23
|
+
|
|
24
|
+
### Use Case:
|
|
25
|
+
Ideal for sites with multiple content types (e.g., blog posts, documentation, projects) that need consistent tag/category pages across all collections.
|
|
26
|
+
|
|
27
|
+
## jekyll-tagging
|
|
28
|
+
|
|
29
|
+
jekyll-tagging is a long-standing plugin focused specifically on generating tag pages for posts.
|
|
30
|
+
|
|
31
|
+
### Key Features:
|
|
32
|
+
- Generates tag pages for blog posts
|
|
33
|
+
- Creates a tag cloud
|
|
34
|
+
- Allows for custom tag page layouts
|
|
35
|
+
- Supports tag pagination (with additional configuration)
|
|
36
|
+
|
|
37
|
+
### Use Case:
|
|
38
|
+
Best for blogs or simple sites that only need tag functionality for posts and want features like tag clouds.
|
|
39
|
+
|
|
40
|
+
## jekyll-category-pages
|
|
41
|
+
|
|
42
|
+
jekyll-category-pages is designed to generate category archive pages for Jekyll sites.
|
|
43
|
+
|
|
44
|
+
### Key Features:
|
|
45
|
+
- Creates category archive pages
|
|
46
|
+
- Supports custom layouts for category pages
|
|
47
|
+
- Works with Jekyll's native category system
|
|
48
|
+
- Generates an overall categories index page
|
|
49
|
+
|
|
50
|
+
### Use Case:
|
|
51
|
+
Suited for sites that primarily use categories for organization and want dedicated category archive pages.
|
|
52
|
+
|
|
53
|
+
## Comparison
|
|
54
|
+
|
|
55
|
+
| Feature | jekyll-collection-pages | jekyll-tagging | jekyll-category-pages |
|
|
56
|
+
|---------|-------------------------|----------------|------------------------|
|
|
57
|
+
| Works with all collections | ✅ | ❌ (posts only) | ❌ (posts only) |
|
|
58
|
+
| Tag support | ✅ | ✅ | ❌ |
|
|
59
|
+
| Category support | ✅ | ❌ | ✅ |
|
|
60
|
+
| Pagination | ✅ | ✅ | ❌ |
|
|
61
|
+
| Custom layouts | ✅ | ✅ | ✅ |
|
|
62
|
+
| Tag cloud | ❌ | ✅ | N/A |
|
|
63
|
+
| Categories index | ✅ | N/A | ✅ |
|
|
64
|
+
|
|
65
|
+
## When to Choose Each Plugin
|
|
66
|
+
|
|
67
|
+
1. **Choose jekyll-collection-pages if:**
|
|
68
|
+
- You have multiple collections and want consistent tag/category pages across all of them
|
|
69
|
+
- You need flexibility in handling both tags and categories
|
|
70
|
+
- You want built-in pagination support
|
|
71
|
+
|
|
72
|
+
2. **Choose jekyll-tagging if:**
|
|
73
|
+
- You only need to handle tags for blog posts
|
|
74
|
+
- You want a tag cloud feature
|
|
75
|
+
- You're okay with additional configuration for pagination
|
|
76
|
+
|
|
77
|
+
3. **Choose jekyll-category-pages if:**
|
|
78
|
+
- You primarily use categories for organizing your posts
|
|
79
|
+
- You don't need tag support
|
|
80
|
+
- You want a simple solution focused solely on category pages
|
|
81
|
+
|
|
82
|
+
## Conclusion
|
|
83
|
+
|
|
84
|
+
While all three plugins offer valuable functionality, Jekyll Collection Pages stands out for its flexibility and comprehensive approach to handling both tags and categories across all collections. It's particularly powerful for sites with diverse content types that need a unified system for content organization.
|
|
85
|
+
|
|
86
|
+
jekyll-tagging remains a solid choice for blogs focused on tag-based navigation, especially if you want features like tag clouds. jekyll-category-pages is best suited for sites that primarily use categories and don't require tag functionality.
|
|
87
|
+
|
|
88
|
+
Ultimately, the best choice depends on your specific needs. Consider your site structure, the importance of tags vs categories, and whether you need to organize content beyond just blog posts when making your decision.
|
|
89
|
+
|
|
90
|
+
Remember, you can always start with a simpler solution and migrate to a more comprehensive one as your site grows and your needs evolve.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
layout: post
|
|
3
|
+
title: "Generate Index Pages from Your Jekyll Collections"
|
|
4
|
+
date: 2025-11-10
|
|
5
|
+
author: Allison Thackston
|
|
6
|
+
tags: [jekyll, plugins, collections, pagination, releases]
|
|
7
|
+
image: /assets/img/post-img-4.png
|
|
8
|
+
description: "Introducing automated collection index pages with site.data.collection_pages"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
The latest release of **`jekyll-collection-pages`** introduces a new way to **generate index pages automatically** for any Jekyll collection.
|
|
12
|
+
Define one simple configuration, and the plugin creates organized, linkable index pages for every unique value of a chosen field — such as `category`, `tags`, or any custom key.
|
|
13
|
+
|
|
14
|
+
## What It Does
|
|
15
|
+
|
|
16
|
+
Until now, creating index pages for collections meant writing a custom generator or manually duplicating layouts.
|
|
17
|
+
With this release, the plugin can now:
|
|
18
|
+
|
|
19
|
+
- Build one index page per unique field value
|
|
20
|
+
- Paginate results automatically
|
|
21
|
+
- Expose a structured dataset in `site.data.collection_pages` for custom UIs
|
|
22
|
+
|
|
23
|
+
That means you can create browsable directories like:
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
/docs/category/getting-started/
|
|
27
|
+
/docs/category/reference/
|
|
28
|
+
/docs/category/usage/
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
All without writing a single custom generator.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
In your `_config.yml`, define the behavior for your collection under `collection_pages`:
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
collection_pages:
|
|
40
|
+
collection: docs
|
|
41
|
+
field: category
|
|
42
|
+
path: docs/category
|
|
43
|
+
layout: collection_layout.html
|
|
44
|
+
paginate: 5
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Then rebuild your site:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
bundle exec jekyll build
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
You’ll find generated pages under `_site/docs/category/<slug>/index.html` — one folder per unique `category` value.
|
|
54
|
+
If you specify `paginate`, the plugin creates additional pages that follow the template (e.g. `/docs/category/getting-started/page2/`) and exposes previous/next links via `page.paginator`.
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
## Generated Data Reference
|
|
58
|
+
|
|
59
|
+
Every run exports metadata into `site.data.collection_pages`, mirroring Jekyll’s built-in `site.tags` and `site.categories`.
|
|
60
|
+
|
|
61
|
+
```liquid
|
|
62
|
+
{% raw %}
|
|
63
|
+
site.data.collection_pages[collection][field]
|
|
64
|
+
{% endraw %}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Each entry includes:
|
|
68
|
+
|
|
69
|
+
- `template` → the full sanitized template used for creating pages with placeholders intact. Directory-style values from `_config.yml` are auto-appended with `:field/page:num/index.html`. (e.g. `/docs/category/:field/page:num/index.html`)
|
|
70
|
+
- `permalink` → the sanitized template for the index with placeholders intact (e.g. `/docs/category/:field/`)
|
|
71
|
+
- `pages` → documents grouped by label (`{ label => [documents...] }`)
|
|
72
|
+
- `labels`: metadata describing the generated index pages
|
|
73
|
+
|
|
74
|
+
### pages
|
|
75
|
+
|
|
76
|
+
Groups documents by label:
|
|
77
|
+
|
|
78
|
+
```liquid
|
|
79
|
+
{% raw %}
|
|
80
|
+
{% assign info = site.data.collection_pages.docs.category %}
|
|
81
|
+
{% for entry in info.pages %}
|
|
82
|
+
{% assign label = entry | first %}
|
|
83
|
+
{% assign documents = entry | last %}
|
|
84
|
+
<h2>{{ label }} ({{ documents.size }})</h2>
|
|
85
|
+
<ul>
|
|
86
|
+
{% for doc in documents %}
|
|
87
|
+
<li><a href="{{ doc.url | relative_url }}">{{ doc.data.title }}</a></li>
|
|
88
|
+
{% endfor %}
|
|
89
|
+
</ul>
|
|
90
|
+
{% endfor %}
|
|
91
|
+
{% endraw %}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### labels
|
|
95
|
+
|
|
96
|
+
Provides metadata for each generated index:
|
|
97
|
+
|
|
98
|
+
- `index`: first generated index page (`index.html`)
|
|
99
|
+
- `pages`: all generated index pages (if paginated)
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
|
|
103
|
+
```liquid
|
|
104
|
+
{% raw %}
|
|
105
|
+
## Index of generated pages
|
|
106
|
+
{%- assign index_by_label = site.data.collection_pages.docs.category.labels %}
|
|
107
|
+
|
|
108
|
+
{% for entry in index_by_label %}
|
|
109
|
+
{% assign label = entry | first %}
|
|
110
|
+
{% assign info = entry | last %}
|
|
111
|
+
<h2> <a href="{{ info.index.url | relative_url }}">{{ label }}</a> ( {{ info.pages.size }})</h2>
|
|
112
|
+
<ul>
|
|
113
|
+
{% for entry in info.pages %}
|
|
114
|
+
<li><a href="{{ entry.url }}">Page {{ entry.page_num }}</a></li>
|
|
115
|
+
{% endfor %}
|
|
116
|
+
</ul>
|
|
117
|
+
{% endfor %}
|
|
118
|
+
{% endraw %}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Example Layout
|
|
122
|
+
|
|
123
|
+
Here’s a minimal `collection_layout.html` template:
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
---
|
|
127
|
+
layout: default
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
<h1>{{ page.title }}</h1>
|
|
131
|
+
|
|
132
|
+
<ul>
|
|
133
|
+
{% for post in page.posts %}
|
|
134
|
+
<li><a href="{{ post.url }}">{{ post.data.title }}</a></li>
|
|
135
|
+
{% endfor %}
|
|
136
|
+
</ul>
|
|
137
|
+
|
|
138
|
+
{% if page.paginator %}
|
|
139
|
+
<nav>
|
|
140
|
+
{% if page.paginator.previous_page %}
|
|
141
|
+
<a href="{{ page.paginator.previous_page_path | relative_url }}">Previous</a>
|
|
142
|
+
{% endif %}
|
|
143
|
+
{% if page.paginator.next_page %}
|
|
144
|
+
<a href="{{ page.paginator.next_page_path | relative_url }}">Next</a>
|
|
145
|
+
{% endif %}
|
|
146
|
+
</nav>
|
|
147
|
+
{% endif %}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`page.paginator.previous_page_path` and `page.paginator.next_page_path` already contain the tag directory (for example `docs/category/reference/` or `docs/category/reference/page2.html`), so passing them through `relative_url` is enough to produce correct links.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Debugging and Development Tips
|
|
155
|
+
|
|
156
|
+
- Dump the full structure with `{% raw %}{{ site.data.collection_pages | jsonify }}{% endraw %}`
|
|
157
|
+
- Enable debug logging:
|
|
158
|
+
```bash
|
|
159
|
+
JEKYLL_LOG_LEVEL=debug bundle exec jekyll build
|
|
160
|
+
```
|
|
161
|
+
- Check field names for case sensitivity — missing labels usually indicate a typo or inconsistent field key.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Why It Matters
|
|
166
|
+
|
|
167
|
+
This feature bridges the gap between Jekyll’s **collections** and **taxonomy-style browsing**, enabling:
|
|
168
|
+
|
|
169
|
+
- Documentation sites with sectioned navigation
|
|
170
|
+
- Blogs organized by topic or author
|
|
171
|
+
- Paginated directories of any custom field
|
|
172
|
+
|
|
173
|
+
No manual duplication, no custom Liquid loops — just configuration.
|