From 993f39f58dd5569e3966fbd2c0092f0f1e795db3 Mon Sep 17 00:00:00 2001
From: icy-comet <50461557+icy-comet@users.noreply.github.com>
Date: Sat, 5 Feb 2022 15:58:12 +0530
Subject: [PATCH 1/2] make Toc a site-wide Param
---
layouts/_default/single.html | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 09c5754..3d375ad 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -28,16 +28,10 @@
{{ end }}
{{ partial "cover.html" . }}
- {{ if .Params.Toc }}
+ {{ if (.Params.Toc | default .Site.Params.Toc) }}
- {{ if .Params.TocTitle }}
- {{ .Params.TocTitle }}
- {{ else if $.Site.Params.TocTitle }}
- {{ $.Site.Params.TocTitle }}
- {{ else }}
- Table of Contents
- {{ end }}
+ {{ (.Params.TocTitle | default .Site.Params.TocTitle) | default "Table of Contents" }}
{{ .TableOfContents }}
From 1b3daa8aecb66c265cfacc02d457cfd4da4eb8c7 Mon Sep 17 00:00:00 2001
From: icy-comet <50461557+icy-comet@users.noreply.github.com>
Date: Sat, 5 Feb 2022 16:17:20 +0530
Subject: [PATCH 2/2] add Toc & readingTime to sample config & change example
formatting
---
README.md | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/README.md b/README.md
index 0013533..582fd65 100644
--- a/README.md
+++ b/README.md
@@ -32,12 +32,18 @@
#### Built-in shortcodes
-- **`image`** (prop required: **`src`**; props optional: **`alt`**, **`position`** (**left** is default | center | right), **`style`**)
- - eg: `{{< image src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" >}}`
+- **`image`** (props required: **`src`**; props optional: **`alt`**, **`position`** (**left** is default | center | right), **`style`**)
+ - e.g.
+ ```go
+ {{< image src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" >}}
+ ```
- **`figure`** (same as `image`, plus few optional props: **`caption`**, **`captionPosition`** (left | **center** is default | right), **`captionStyle`**)
- - eg: `{{< figure src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" caption="Hello Friend!" captionPosition="right" captionStyle="color: red;" >}}`
-- **`code`** (prop required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**)
- - eg:
+ - e.g.
+ ```go
+ {{< figure src="/img/hello.png" alt="Hello Friend" position="center" style="border-radius: 8px;" caption="Hello Friend!" captionPosition="right" captionStyle="color: red;" >}}
+ ```
+- **`code`** (props required: **`language`**; props optional: **`title`**, **`id`**, **`expand`** (default "△"), **`collapse`** (default "▽"), **`isCollapsed`**)
+ - e.g.
```go
{{< code language="css" title="Really cool snippet" id="1" expand="Show" collapse="Hide" isCollapsed="true" >}}
pre {
@@ -148,8 +154,18 @@ paginate = 5
# updatedDatePrefix = "Updated"
# set all headings to their default size (depending on browser settings)
- # it's set to `true` by default
- # oneHeadingSize = false
+ # oneHeadingSize = true # default
+
+ # whether to show a page's estimated reading time
+ # readingTime = false # default
+
+ # whether to show a table of contents
+ # can be overridden in a page's front-matter
+ # Toc = false # default
+
+ # set title for the table of contents
+ # can be overridden in a page's front-matter
+ # TocTitle = "Table of Contents" # default
[params.twitter]