You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✨ I would like to add a new parameter canonicalUrl to front matter that set a different canonical URL.
Right now the default behaviour is to set the <link rel="canonical"> tag to the permalink of the page, which is fine in most of the cases, but sometimes I have to publish in other blogs (i.e. company blog) and I like to cross-post in my own site without affecting SEO. With this new feature it is possible to set a custom canonical URL when needed just by adding the parameter canonicalUrl to the front matter of the page.
The change consist in modify the file layouts/partials/head.html from this:
<linkrel="canonical" href="{{ .Permalink }}" />
To this:
{{ if .Params.canonicalUrl }}
<linkrel="canonical" href="{{ .Params.canonicalUrl }}" />
{{ else }}
<linkrel="canonical" href="{{ .Permalink }}" />
{{ end }}
I have tested the change and works as expected. If the feature is approved I could do a PR.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi!
✨ I would like to add a new parameter
canonicalUrl
to front matter that set a different canonical URL.Right now the default behaviour is to set the
<link rel="canonical">
tag to the permalink of the page, which is fine in most of the cases, but sometimes I have to publish in other blogs (i.e. company blog) and I like to cross-post in my own site without affecting SEO. With this new feature it is possible to set a custom canonical URL when needed just by adding the parametercanonicalUrl
to the front matter of the page.The change consist in modify the file
layouts/partials/head.html
from this:To this:
I have tested the change and works as expected. If the feature is approved I could do a PR.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions