mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-15 20:44:01 +02:00
Fix some server rebuild issues for non-HTML custom output formats
The failing test case here is * A custom search output format defined on the home page, marked as `noAlternative` and not `permalinkable` * In fast render mode, when making a change to a data source for that search output format, the JSON file was not refreshed. There are variants of the above, but the gist of it is: * The change set was correctly determined, but since the search JSON file was not in the recently visited browser stack, we skipped rendering it. Running with `hugo server --disableFastRender` would be a workaround for the above. This commit fixes this by: * Adding a check for the HTTP request header `Sec-Fetch-Mode = navigation` to the condition for if we should track server request as a user navigation (and not e.g. a HTTP request for a linked CSS stylesheet). * Making sure that we compare against the real relative URL for non-permalinkable output formats. Fixes #13014
This commit is contained in:
@@ -20,6 +20,7 @@ import (
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/bep/logg"
|
||||
"github.com/gohugoio/hugo/common/herrors"
|
||||
"github.com/gohugoio/hugo/hugolib/doctree"
|
||||
|
||||
@@ -33,6 +34,8 @@ import (
|
||||
type siteRenderContext struct {
|
||||
cfg *BuildCfg
|
||||
|
||||
infol logg.LevelLogger
|
||||
|
||||
// languageIdx is the zero based index of the site.
|
||||
languageIdx int
|
||||
|
||||
@@ -86,7 +89,7 @@ func (s *Site) renderPages(ctx *siteRenderContext) error {
|
||||
Tree: s.pageMap.treePages,
|
||||
Handle: func(key string, n contentNodeI, match doctree.DimensionFlag) (bool, error) {
|
||||
if p, ok := n.(*pageState); ok {
|
||||
if cfg.shouldRender(p) {
|
||||
if cfg.shouldRender(ctx.infol, p) {
|
||||
select {
|
||||
case <-s.h.Done():
|
||||
return true, nil
|
||||
|
Reference in New Issue
Block a user