Browse Source

Add shortcode for generating table of contents (#258)

George Cushen 8 năm trước cách đây
mục cha
commit
06dc780e6c

+ 2 - 0
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:

+ 3 - 0
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

+ 2 - 0
layouts/shortcodes/toc.html

@@ -0,0 +1,2 @@
+<h2>{{ i18n "table_of_contents" }}</h2>
+{{ $.Page.TableOfContents }}