From bddebada1aeee5eb87ff4e52a0b7bdf9c966f912 Mon Sep 17 00:00:00 2001 From: a73x Date: Sun, 29 Sep 2024 10:09:46 +0100 Subject: feat(web): made toc optional --- pages/pages.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'pages') 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 { -- cgit v1.2.3