Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to specify canonical url #151

Closed
donovanglover opened this issue Sep 13, 2023 · 9 comments · Fixed by #168
Closed

Option to specify canonical url #151

donovanglover opened this issue Sep 13, 2023 · 9 comments · Fixed by #168
Labels
enhancement New feature or request

Comments

@donovanglover
Copy link
Contributor

Feature Request

Summary

Use <meta rel="canonical"> for SEO on all pages.

Motivation

An option is useful when a site is deployed to multiple domains and one domain is preferred

Detailed Description

https://developers.google.com/search/docs/crawling-indexing/consolidate-duplicate-urls

Additional Context

https://moz.com/blog/cross-domain-rel-canonical-seo-value-cross-posted-content
https://yoast.com/rel-canonical/

@donovanglover donovanglover added the enhancement New feature or request label Sep 13, 2023
@welpo
Copy link
Owner

welpo commented Sep 13, 2023

This would only make sense as a page.extra variable, right? I.e. in individual posts but not on config.toml or sections.

@donovanglover
Copy link
Contributor Author

Personally I would only use config.toml since I have multiple domains and one does better in search results. So https://example.link/ has canonical URLs to https://betterforseo.com/.

page.extra could be useful for one-time things though.

@welpo
Copy link
Owner

welpo commented Sep 13, 2023

From my reading, I understood the canonical tag is intended to specify the authoritative version of each individual page, so it needs to match the content and context of that specific page.

If that's correct, setting a single URL for all pages on a site would not be appropriate.

Would you expect the canonical URL to be smart? For example, to set a base_canonical_url on config.toml and have it match the base_url content. In this case, example.com/post1 would match to example.es/post1.

@donovanglover
Copy link
Contributor Author

That's correct.

@welpo
Copy link
Owner

welpo commented Sep 14, 2023

I'll add the option to pages, sections and config.toml, with a warning in comments as to the "content needs to really match" issue.

@welpo
Copy link
Owner

welpo commented Sep 15, 2023

@donovanglover would you like to test the feature on the branch feat/custom-canonical-url?

@donovanglover
Copy link
Contributor Author

Would love to try it out! Should be able to test it sometime this weekend

@donovanglover
Copy link
Contributor Author

Seems to work for me, thanks!

@welpo
Copy link
Owner

welpo commented Sep 18, 2023

Thanks for testing! The feature is now live, following PR #168.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants