Use correct protocol for canonical URLs
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 66
- Forks
- 36
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 16
Description
There is currently a Force HTTPS Canonicals setting, that changes the protocol for URLs in the structured metadata, independently of whether the home_url() uses https or not.
By default, this setting is set to false - that is, http is used - even when the site uses https in the home URL.
This has the effect that a WP instance at https://example.com will get URLs that start with http://example.com which therefore makes it incorrect as being the "canonical URL", since canonical URLs need to take into account the protocol as well.
A customer support ticket implies that the Yoast SEO plugin seems to want to use the correct protocol (as would make sense), but this needs confirming.
Existing customers will have their data indexed under http (unless they've already changed the setting), so implementing behaviour that checks the home_url() and adjusts the protocol used in canonical URLs, will mean having to do a re-index.
As such, any change in behaviour here should only be for new installs (check for a version number saved in the options, and only change the behaviour if the version is present and equal to or greater than the release in which the change is implemented).
Alternatively, this change is made for everyone, but all of the relevant sites will need a reindex (can that be notified / triggered remotely?). On a site with 400-500k URLs, this could take around a day.
When this new behaviour is implemented (canonical URL protocols match the home_url() protocol), then the Force HTTPS Canonicals setting can be hidden. It could even be considered deprecated and marked for removal in a future major release.
One additional thing would to then add an admin notice for when the home URL is changed on the Settings->General screen, to advise that a Parse.ly reindex is needed.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Force HTTPS Canonicals setting in wp-parsely.php at lines 494-505 and trace how canonical URLs use home_url(). Review the saved version option and the Settings->General flow mentioned in the issue, then identify how reindexing and an admin notice would be handled. Done means the migration behavior, setting deprecation or removal, and home-URL change warning are defined without disrupting existing indexed data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100