User Guide

This guide indicates how to add support for tags on pages (and extra support for tags on posts) to a static website generated using Jekyll.

The reader is assumed to be familiar with Jekyll and Liquid.

Folders

Create the following files and folders:

The current version of tag/index.md combines the tag cloud, the list of all tag descriptions, and the listings of any tags that do not have separate pages. To show these items on different pages, the Liquid code in _includes/tags/ would need to be updated.

Configuration

Update the file _config.yml by adding the following lines:

exclude:
  - tag/TAG.md

collections:
  tag:
    output: true
    permalink: /:collection/:name

defaults:
  -
    scope:
      path: ""
      type: "tag"
    values:
      title: "Tag index"
      layout: "default"
      excerpt: "List of tagged pages"

The defaults for the tag pages can be changed. The default for excerpt is an optimisation: processing the page for each tag involves inspecting all pages in site.pages, to find the pages with corresponding tags; and when the tag pages do not have explicit excerpt fields, it appears that Jekyll processes them twice.

Implementation

The tag support is implemented entirely in Liquid using the partials in _includes/tags/:

The remaining partials are used in the above files for low-level formatting and to initialise variables to derived data.

The profiling data shows the overhead due to tag processing. Some of it may be due to extensive use of inclusion of partials.