Upgrade to TOC header in Minimal Mistakes Jekyll theme

Related: Create fast, beautiful website with Minimal Mistakes Jekyll theme


sed Stream Editor and find are combined to instantly remove include toc from a large number of pages. Minimal Mistakes Jekyll theme ≥ 4.7 has a new toc: true header field. Here’s how to quickly upgrade to automatic table of contents listing for all of your pages and posts at once.

  1. make a backup copy of your Minimal Mistakes webpage directory.
  2. delete all legacy toc includes:

    find . -type f -name “*.md” -exec sed -i ‘s/{% include toc %}//g’ {} +

  3. insert into _config.yml in the appropriate scope the toc: true value. For example:

     defaults:
       - scope:
           path: ""
         values:
           layout: single
           toc: true
    
  4. Verify it’s working before uploading
    bundle exec jekyll serve
    

    and browse to http://localhost:4000 to check a few pages that table of contents is working.

    • Don’t use the --incremental option as you changed _config.yml.
    • If something isn’t working, make your changes, close and restart this command to make _config.yml changes take effect.
  5. When satisfied, git commit and git push.

Leave a Comment