mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
@@ -492,7 +492,13 @@ func (h *HugoSites) setupTranslations() {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Site) preparePagesForRender(cfg *BuildCfg) {
|
||||
func (s *Site) preparePagesForRender(outFormatIdx int, cfg *BuildCfg) {
|
||||
|
||||
if outFormatIdx > 0 {
|
||||
// TODO(bep) for now
|
||||
return
|
||||
}
|
||||
|
||||
pageChan := make(chan *Page)
|
||||
wg := &sync.WaitGroup{}
|
||||
numWorkers := getGoMaxProcs() * 4
|
||||
|
@@ -203,26 +203,31 @@ func (h *HugoSites) assemble(config *BuildCfg) error {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, s := range h.Sites {
|
||||
s.preparePagesForRender(config)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (h *HugoSites) render(config *BuildCfg) error {
|
||||
if !config.SkipRender {
|
||||
|
||||
for _, s := range h.Sites {
|
||||
if err := s.render(); err != nil {
|
||||
s.initRenderFormats()
|
||||
for i, rf := range s.renderFormats {
|
||||
s.rc = &siteRenderingContext{Format: rf}
|
||||
s.preparePagesForRender(i, config)
|
||||
|
||||
if !config.SkipRender {
|
||||
if err := s.render(i); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if config.PrintStats {
|
||||
if !config.SkipRender && config.PrintStats {
|
||||
s.Stats()
|
||||
}
|
||||
}
|
||||
|
||||
if !config.SkipRender {
|
||||
if err := h.renderCrossSitesArtifacts(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@@ -309,6 +309,7 @@ func executeShortcodeFuncMap(funcs map[string]func() (string, error)) (map[strin
|
||||
}
|
||||
|
||||
func renderShortcodes(shortcodes map[string]shortcode, p *Page) map[string]func() (string, error) {
|
||||
|
||||
renderedShortcodes := make(map[string]func() (string, error))
|
||||
|
||||
for key, sc := range shortcodes {
|
||||
@@ -316,8 +317,8 @@ func renderShortcodes(shortcodes map[string]shortcode, p *Page) map[string]func(
|
||||
// need to have something to replace with
|
||||
renderedShortcodes[key] = emptyShortcodeFn
|
||||
} else {
|
||||
shorctode := sc
|
||||
renderedShortcodes[key] = func() (string, error) { return renderShortcode(shorctode, nil, p), nil }
|
||||
shortcode := sc
|
||||
renderedShortcodes[key] = func() (string, error) { return renderShortcode(shortcode, nil, p), nil }
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -986,8 +986,9 @@ func (s *Site) setupSitePages() {
|
||||
s.Info.LastChange = siteLastChange
|
||||
}
|
||||
|
||||
func (s *Site) render() (err error) {
|
||||
func (s *Site) render(outFormatIdx int) (err error) {
|
||||
|
||||
if outFormatIdx == 0 {
|
||||
if err = s.preparePages(); err != nil {
|
||||
return
|
||||
}
|
||||
@@ -1002,16 +1003,19 @@ func (s *Site) render() (err error) {
|
||||
}
|
||||
s.timerStep("render and write aliases")
|
||||
|
||||
// TODO(bep) render consider this, ref. render404 etc.
|
||||
s.initRenderFormats()
|
||||
for _, rf := range s.renderFormats {
|
||||
s.rc = &siteRenderingContext{Format: rf}
|
||||
}
|
||||
|
||||
if err = s.renderPages(); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
s.timerStep("render and write pages")
|
||||
|
||||
// TODO(bep) render consider this, ref. render404 etc.
|
||||
if outFormatIdx > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
if err = s.renderSitemap(); err != nil {
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user