Add canonicalUrl parameter

This commit is contained in:
HactarCE
2025-04-02 11:25:03 -04:00
parent 343ba2a4ae
commit bc07e401ad
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] ## [Unreleased]
### Added
- `canonicalUrl` parameter for page front matter
### Fixed ### Fixed
- Shortcodes placed after code blocks with line numbers are rendered with incorrect spacing ([#987](https://github.com/jpanther/congo/issues/987)) - Shortcodes placed after code blocks with line numbers are rendered with incorrect spacing ([#987](https://github.com/jpanther/congo/issues/987))
+5 -1
View File
@@ -94,7 +94,11 @@
{{ with .Params.robots }} {{ with .Params.robots }}
<meta name="robots" content="{{ . }}" /> <meta name="robots" content="{{ . }}" />
{{ end }} {{ end }}
<link rel="canonical" href="{{ .Permalink }}" /> {{ if .Params.canonicalUrl }}
<link rel="canonical" href="{{ .Params.canonicalUrl }}">
{{ else }}
<link rel="canonical" href="{{ .Permalink }}">
{{ end }}
{{ range .AlternativeOutputFormats -}} {{ range .AlternativeOutputFormats -}}
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | safeHTML }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink ($.Site.Title | emojify) | safeHTML }}
{{ end -}} {{ end -}}