Generate a separate page for each tag/category/author/... pages for Jekyll static site generator (e.g. for Github Pages). Topical index pages for tags, categories, ... are great for your readers and for SEO.
Program: jekyll_taxonomy 1.2.2 by peter@forret.com
Updated: Oct 21 15:37:34 2021
Description: Generate tag and category pages for Jekyll SSG
Usage: jekyll_taxonomy
[-h] [-q] [-v] [-f] [-c]
[-l <log_dir>] [-t <tmp_dir>] [-p <post_dir>] [-y <layout_dir>] [-o <collection>]
<action> <type?> <output?>
Flags, options and parameters:
-h|--help : [flag] show usage [default: off]
-q|--quiet : [flag] no output [default: off]
-v|--verbose : [flag] output more [default: off]
-f|--force : [flag] do not ask for confirmation (always yes) [default: off]
-c|--cleanup : [flag] clean the output folder first [default: off]
-l|--log_dir <?> : [option] folder for log files [default: /Users/pforret/log/jekyll_taxonomy]
-t|--tmp_dir <?> : [option] folder for temp files [default: /tmp/jekyll_taxonomy]
-p|--post_dir <?>: [option] input folder with Jekyll posts [default: _posts]
-y|--layout_dir <?>: [option] folder with Jekyll layouts [default: _layouts]
-o|--collection <?>: [option] collection name (_posts -> posts)
<action> : [parameter] action to perform generate/check/update
<type> : [parameter] tag/category/author/... (optional)
<output> : [parameter] output folder [default: /<type>] (optional)
### TIPS & EXAMPLES
* use jekyll_taxonomy generate tag to generate all tag documents
* use jekyll_taxonomy check to check if this script is ready to execute and what values the options/flags are
* use jekyll_taxonomy env to generate an example .env file
* use jekyll_taxonomy update to update to the latest version
* >>> bash script created with pforret/bashew
* >>> for bash development, also check out pforret/setver and pforret/progressbar
jekyll_taxonomy generate tag
: generate a tag index page for each unique tag defined bytag:
ortags:
in your posts' front matter. All tags are lowercase and slugified (Apple -> apple, FIRST TRY! -> first-try). The index page will list all _posts with that tag, with a title, date and excerpt. Also, a layoutwith_tag
is created in_layouts
and a index pageindex.html
, listing all tags, is created in thetag
folder.jekyll_taxonomy -p _products -y _templates generate age age_group
: generate an age index page in the folder _age_group
for each unique age group defined byage:
orages:
in your products' front matter. All tags are lowercase and slugified (Adult -> adult, Baby Girl -> baby-girl). Also, a layoutwith_age
is created in_templates
and an index pageindex.html
is created in theage_group
folder.jekyll_taxonomy -c generate category
: first remove all .md pages from the category folder and then recreate them from the posts (defined bycategory:
andcategories:
in the front matter). Useful when categories (could) have disappeared because e.g. some posts were deleted or categories were renamed.tag/index.html
can be modified to e.g. separate tag listing on 1st letter, or use a Bootstrap/Tailwind specific layout_layouts/with_tag.html
can be modified to e.g. remove the excerpt or make it longer, to add the author, or use a Bootstrap/Tailwind specific layout
I use it on my Jekyll blog:
- blog.forret.com/category/ for the category listing
- blog.forret.com/category/github/ for the index page for category 'github'
- blog.forret.com/tag/ for the tag listing (with a more compact format)
- blog.forret.com/tag/bash/ for the index page of the tag 'bash'
These are generated by the following script:
jekyll_taxonomy -c generate tag
git add tag ## add any new tag indexes to git
jekyll_taxonomy -c generate category
git add category ## add any new category indexes to git
git status ## show me added/removed tags and categories
with basher
$ basher install pforret/jekyll_taxonomy
or with git
$ git clone https://github.com/pforret/jekyll_taxonomy.git
$ cd jekyll_taxonomy
- script created with bashew
ยฉ 2021 Peter Forret