From 06dc780e6cf24e92db319a2e4f9918ec3ab4acb6 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 3 Sep 2017 15:07:38 +0100 Subject: [PATCH] Add shortcode for generating table of contents (#258) --- exampleSite/content/post/getting-started.md | 2 ++ i18n/en.yaml | 3 +++ layouts/shortcodes/toc.html | 2 ++ 3 files changed, 7 insertions(+) create mode 100644 layouts/shortcodes/toc.html diff --git a/exampleSite/content/post/getting-started.md b/exampleSite/content/post/getting-started.md index 2aa90096..6b34b2d0 100644 --- a/exampleSite/content/post/getting-started.md +++ b/exampleSite/content/post/getting-started.md @@ -28,6 +28,8 @@ Key features: - Simple and refreshing one page design - Easy to customize +{{% toc %}} + ## Installation 1. [Install Hugo](https://georgecushen.com/create-your-website-with-hugo/#installing-hugo) and create a new website by typing the following commands in your *Terminal* or *Command Prompt* app: diff --git a/i18n/en.yaml b/i18n/en.yaml index e43d180d..c735178e 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -3,6 +3,9 @@ - id: toggle_navigation translation: Toggle navigation +- id: table_of_contents + translation: Table of Contents + # Buttons - id: btn_details diff --git a/layouts/shortcodes/toc.html b/layouts/shortcodes/toc.html new file mode 100644 index 00000000..31dd72c0 --- /dev/null +++ b/layouts/shortcodes/toc.html @@ -0,0 +1,2 @@ +

{{ i18n "table_of_contents" }}

+{{ $.Page.TableOfContents }}