mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-24 21:56:05 +02:00
hugolib: Fix reloading corner cases for shortcodes
This commit fixes two different, but related issues: 1) Live-reload when a new shortcode was defined in the content file before the shortcode itself was created. 2) Live-reload when a newly defined shortcode changed its "inner content" status. This commit also improves the shortcode related error messages to include the full path to the content file in question. Fixes #3156
This commit is contained in:
@@ -571,9 +571,9 @@ func (h *HugoSites) Pages() Pages {
|
||||
}
|
||||
|
||||
func handleShortcodes(p *Page, rawContentCopy []byte) ([]byte, error) {
|
||||
if len(p.contentShortCodes) > 0 {
|
||||
p.s.Log.DEBUG.Printf("Replace %d shortcodes in %q", len(p.contentShortCodes), p.BaseFileName())
|
||||
shortcodes, err := executeShortcodeFuncMap(p.contentShortCodes)
|
||||
if p.shortcodeState != nil && len(p.shortcodeState.contentShortCodes) > 0 {
|
||||
p.s.Log.DEBUG.Printf("Replace %d shortcodes in %q", len(p.shortcodeState.contentShortCodes), p.BaseFileName())
|
||||
shortcodes, err := executeShortcodeFuncMap(p.shortcodeState.contentShortCodes)
|
||||
|
||||
if err != nil {
|
||||
return rawContentCopy, err
|
||||
|
Reference in New Issue
Block a user