From: Bjørn Erik Pedersen Date: Fri, 7 Apr 2017 09:01:36 +0000 (+0200) Subject: hugolib: Only do link transforms etc. on HTML type of pages X-Git-Tag: v0.20~13 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5714531f;p=brevno-suite%2Fhugo hugolib: Only do link transforms etc. on HTML type of pages See #2828 --- diff --git a/hugolib/site.go b/hugolib/site.go index 345085ef..b1371045 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -1893,18 +1893,22 @@ func (s *Site) renderAndWritePage(name string, dest string, p *PageOutput, layou transformLinks := transform.NewEmptyTransforms() - if s.Info.relativeURLs || s.Info.canonifyURLs { - transformLinks = append(transformLinks, transform.AbsURL) - } + isHTML := p.outputFormat.IsHTML - if s.running() && s.Cfg.GetBool("watch") && !s.Cfg.GetBool("disableLiveReload") { - transformLinks = append(transformLinks, transform.LiveReloadInject(s.Cfg.GetInt("port"))) - } + if isHTML { + if s.Info.relativeURLs || s.Info.canonifyURLs { + transformLinks = append(transformLinks, transform.AbsURL) + } - // For performance reasons we only inject the Hugo generator tag on the home page. - if p.IsHome() { - if !s.Cfg.GetBool("disableHugoGeneratorInject") { - transformLinks = append(transformLinks, transform.HugoGeneratorInject) + if s.running() && s.Cfg.GetBool("watch") && !s.Cfg.GetBool("disableLiveReload") { + transformLinks = append(transformLinks, transform.LiveReloadInject(s.Cfg.GetInt("port"))) + } + + // For performance reasons we only inject the Hugo generator tag on the home page. + if p.IsHome() { + if !s.Cfg.GetBool("disableHugoGeneratorInject") { + transformLinks = append(transformLinks, transform.HugoGeneratorInject) + } } }