]> git.maquefel.me Git - brevno-suite/hugo/commit
hugolib: Fix newly created shortcodes not found during server rebuild
authorRohan Hasabe <rohanhasabe8@gmail.com>
Sun, 11 Jan 2026 17:00:23 +0000 (12:00 -0500)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sun, 11 Jan 2026 18:33:00 +0000 (19:33 +0100)
commit66ba63cd5f30ef8807fc524dbc67399376299bb1
treed64a7e2079b3d0eedbf68453557d0fe93cd35efa
parenteb06a3cd0ce98da5038e25cc9a28834b313d482c
hugolib: Fix newly created shortcodes not found during server rebuild

When a new shortcode file was added during `hugo server`, the shortcode
was detected but not properly registered in the template cache. This caused
subsequent content edits using the shortcode to fail with "template for
shortcode not found" until the server was restarted.

The issue was that when a shortcode was added, only a glob identity for
dependent content was added to the changes list, but not the shortcode
file's own pathInfo. This meant RefreshFiles filtered it out and never
inserted it into the shortcodesByName cache.

The fix adds the shortcode file's pathInfo to changes (in addition to the
glob for dependent content), and corrects the glob pattern from
`shortcodes/...` to `/_shortcodes/...` to match the actual path format.

Fixes #14207
hugolib/hugo_sites_build.go
hugolib/rebuild_test.go