summaryrefslogtreecommitdiff
path: root/pages
diff options
context:
space:
mode:
authora73x <[email protected]>2024-09-29 10:09:46 +0100
committera73x <[email protected]>2024-09-29 10:09:46 +0100
commitbddebada1aeee5eb87ff4e52a0b7bdf9c966f912 (patch)
treef74b403957febe52faa261aad2ca80c0ff46be20 /pages
parent917043de43777fc1429e23ced7cf9d179cbcf61f (diff)
feat(web): made toc optional
Diffstat (limited to 'pages')
-rw-r--r--pages/pages.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pages/pages.go b/pages/pages.go
index 8adb9e1..5ca5cff 100644
--- a/pages/pages.go
+++ b/pages/pages.go
@@ -48,7 +48,13 @@ func renderTemplate(config GlobalState, content markdown.Content) (string, error
return "", fmt.Errorf("failed to execute content template: %v", err)
}
- data.Body = string(html.MDToHTML(newContent.Bytes()))
+ hasToc := false
+ _, ok := content.Meta["toc"]
+ if ok {
+ hasToc = content.Meta["toc"].(bool)
+ }
+
+ data.Body = string(html.MDToHTML(newContent.Bytes(), hasToc))
b := &bytes.Buffer{}
if err := t.Execute(b, data); err != nil {