mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Add render template hooks for links and images
This commit also * revises the change detection for templates used by content files in server mode. * Adds a Page.RenderString method Fixes #6545 Fixes #4663 Closes #6043
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/gohugoio/hugo/identity"
|
||||
|
||||
radix "github.com/armon/go-radix"
|
||||
|
||||
"github.com/gohugoio/hugo/output"
|
||||
@@ -411,7 +413,6 @@ func applyDeps(cfg deps.DepsCfg, sites ...*Site) error {
|
||||
}
|
||||
d.OutputFormatsConfig = s.outputFormatsConfig
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
@@ -806,12 +807,40 @@ func (h *HugoSites) findPagesByKindIn(kind string, inPages page.Pages) page.Page
|
||||
return h.Sites[0].findPagesByKindIn(kind, inPages)
|
||||
}
|
||||
|
||||
func (h *HugoSites) findPagesByShortcode(shortcode string) page.Pages {
|
||||
var pages page.Pages
|
||||
func (h *HugoSites) resetPageStateFromEvents(idset identity.Identities) {
|
||||
|
||||
for _, s := range h.Sites {
|
||||
pages = append(pages, s.findPagesByShortcode(shortcode)...)
|
||||
PAGES:
|
||||
for _, p := range s.rawAllPages {
|
||||
OUTPUTS:
|
||||
for _, po := range p.pageOutputs {
|
||||
if po.cp == nil {
|
||||
continue
|
||||
}
|
||||
for id, _ := range idset {
|
||||
if po.cp.dependencyTracker.Search(id) != nil {
|
||||
po.cp.Reset()
|
||||
p.forceRender = true
|
||||
continue OUTPUTS
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for _, s := range p.shortcodeState.shortcodes {
|
||||
for id, _ := range idset {
|
||||
if idm, ok := s.info.(identity.Manager); ok && idm.Search(id) != nil {
|
||||
for _, po := range p.pageOutputs {
|
||||
if po.cp != nil {
|
||||
po.cp.Reset()
|
||||
}
|
||||
}
|
||||
p.forceRender = true
|
||||
continue PAGES
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return pages
|
||||
}
|
||||
|
||||
// Used in partial reloading to determine if the change is in a bundle.
|
||||
|
Reference in New Issue
Block a user