diff options
Diffstat (limited to 'resources/page/page_outputformat.go')
-rw-r--r-- | resources/page/page_outputformat.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/resources/page/page_outputformat.go b/resources/page/page_outputformat.go index 9eed8241e..44f290025 100644 --- a/resources/page/page_outputformat.go +++ b/resources/page/page_outputformat.go @@ -66,8 +66,18 @@ func (o OutputFormat) RelPermalink() string { } func NewOutputFormat(relPermalink, permalink string, isCanonical bool, f output.Format) OutputFormat { + isUserConfigured := true + for _, d := range output.DefaultFormats { + if strings.EqualFold(d.Name, f.Name) { + isUserConfigured = false + } + } rel := f.Rel - if isCanonical { + // If the output format is the canonical format for the content, we want + // to specify this in the "rel" attribute of an HTML "link" element. + // However, for custom output formats, we don't want to surprise users by + // overwriting "rel" + if isCanonical && !isUserConfigured { rel = "canonical" } return OutputFormat{Rel: rel, Format: f, relPermalink: relPermalink, permalink: permalink} |