Skip to content

pforret/jekyll_taxonomy

Repository files navigation

bash_unit CI Shellcheck CI GH Language GH stars GH tag GH License basher install

jekyll_taxonomy

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.

🔥 Usage

Program: jekyll_taxonomy 1.2.2 by [email protected]
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

🧪 Examples

  • jekyll_taxonomy generate tag: generate a tag index page for each unique tag defined by tag: or tags: 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 layout with_tag is created in _layouts and a index page index.html, listing all tags, is created in the tag 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 by age: or ages: in your products' front matter. All tags are lowercase and slugified (Adult -> adult, Baby Girl -> baby-girl). Also, a layout with_age is created in _templates and an index page index.html is created in the age_group folder.
  • jekyll_taxonomy -c generate category: first remove all .md pages from the category folder and then recreate them from the posts (defined by category: and categories: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:

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

🚀 Installation

with basher

$ basher install pforret/jekyll_taxonomy

or with git

$ git clone https://github.com/pforret/jekyll_taxonomy.git
$ cd jekyll_taxonomy

📝 Acknowledgements

© 2021 Peter Forret