summaryrefslogtreecommitdiffstats
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-04-07 11:01:36 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2017-04-07 11:02:23 +0200
commit5714531f34469234035323bc9e1cc9de33a8f839 (patch)
tree7ff5875ef4c9069b831dfe3d5092681c3d0ae0ae /hugolib
parent3c405f5172a6081483c9e5f4264a4d60e60bc8ac (diff)
hugolib: Only do link transforms etc. on HTML type of pages
See #2828
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/site.go24
1 files changed, 14 insertions, 10 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 345085ef7..b1371045b 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)
+ }
}
}