Hello,
I am having trouble getting a toc working from a custom shortcode. Here is what I have tried.
Versions:
> hugo version
hugo v0.147.8+extended+withdeploy darwin/arm64 BuildDate=2025-06-07T12:59:52Z VendorInfo=brew
> cat ./go.mod
module example.com
go 1.20
require github.com/McShelby/hugo-theme-relearn v0.0.0-20250603165220-e59b0bd36c54 // indirect
> cat ./themes/hugo-theme-relearn/go.mod
module github.com/McShelby/hugo-theme-relearn
go 1.18
My config file /Users/rob.bram/work/Hugo/Sites/RobPedia/hugo.toml has toc settings:
[markup]
[markup.goldmark]
[markup.goldmark.extensions]
definitionList = true
footnote = true
linkify = true
strikethrough = true
table = true
taskList = true
typographer = true
[markup.goldmark.parser]
attribute = true
autoHeadingID = true
autoHeadingIDType = "github"
[markup.goldmark.renderer]
hardWraps = false
unsafe = true
xHTML = false
[markup.tableOfContents]
endLevel = 5
ordered = false
startLevel = 2
I create the toc.html:
> cat layouts/shortcodes/toc.html
{{ .Page.TableOfContents }}
Then added it to a page:
---
title: Test page
toc: true
---
**Table of Contents**
{{< toc >}}
I refresh the page and see no change it it, but I see this in the console:
Change detected, rebuilding site (#79).
2025-08-31 10:31:06.687 +1000
Source changed /current-issue/files/runallxsl.md
ERROR Rebuild failed: process: "/Users/rob.bram/ci/files/runAllXsl.md:11:1": failed to extract shortcode: template for shortcode "toc" not found
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Total in 32 ms
Any hints would be welcome.
Rob
![]()