-
Notifications
You must be signed in to change notification settings - Fork 54
Add rel=canonical to most old html files. #39
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
Conversation
rel=canonical is supposed to be helpful for search engine to know which pages a search engine should promote. This is _not_ a redirect. If a file exists and is and is not in a versioned (x.y.z) folder; consider it as a potential "canonical" target If a file exist in a versioned doc of matplotlib make its rel=canonical point to the corresponding candidate. Example: path/to/foo.html -> candidate as being canonical 3.0.1/path/to/foo.html > set rel=canonical to matplotlib.org/path/to/foo.html Special case the `examples` and `gallery` folder. The `example` folder is from old matplotlib version (2.0.2) but still quite popular on Google; special case. 1) Apply the same rule as above but from withing `examples` toward `gallery`: /gallery/path/to/foo.html -> candidate as being canonical /example/path/to/foo.html > set rel=canonical to matplotlib.org/gallery/path/to/foo.html This took care of 145 files. 2) Many examples were "moved" during examples -> gallery transition. If filename is unique in gallery; use this as a potential heuristic for detecting move: /gallery/path/to/verryuniquename.html -> candidate as being canonical as the filename is unique ! /example/old/location/verryuniquename.html > set rel=canonical to matplotlib.org/gallery/path/to/verryuniquename.html This took care of 185 files in example Leaving 271 "orphan" 3) Resolve chain of rel-canonical. Fix links that point to example that themselves point to gallery. /gallery/path/to/verryuniquename.html /example/old/location/verryuniquename.html -> matplotlib.org/gallery/path/to/verryuniquename.html /2.0.2/example/old/location/verryuniquename.html -> should point to /example/.... make it point to /gallery/.... No files with existing rel=canonical have been touched. This will likely only affect pre-3.0 documentation files.
Need to look at the |
For https://matplotlib.org/users/navigation_toolbar.html and partially it contains files where the current version is actually in the tutorials or some other section, e.g. https://matplotlib.org/users/annotations.html should now really be |
Is this ready to go? Shall we just merge this and see what happens? Do you have some example search terms to be able to later verify if it had the desired effect? |
I believe it is.
That would be great.
We can either look at the traffic on google analytics (though I don't have access). My use case was the following search in google,
Matplotlib examples also:
|
Note that there are more fixes that should come on top of these, but they are special case so not included. |
Thanks, much appreciated. |
rel=canonical is supposed to be helpful for search engine to know
which pages a search engine should promote.
This is not a redirect.
If a file exists and is not in a versioned (x.y.z) folder; consider it
as a potential "canonical" target
If a file exist in a versioned doc of matplotlib make its rel=canonical
point to the corresponding candidate.
Example:
Special case the
examples
andgallery
folder.The
examples
folder is from old matplotlib version (2.0.2) but stillquite popular on Google; special case.
Apply the same rule as above but from withing
examples
towardgallery
:/gallery/path/to/foo.html -> candidate as being canonical
/example/path/to/foo.html > set rel=canonical to matplotlib.org/gallery/path/to/foo.html
This took care of 145 files.
Many examples were "moved" during examples -> gallery transition. If
filename is unique in gallery; use this as a potential heuristic for
detecting move:
/gallery/path/to/verryuniquename.html -> candidate as being canonical as the filename is unique !
/example/old/location/verryuniquename.html > set rel=canonical to matplotlib.org/gallery/path/to/verryuniquename.html
This took care of 185 files in example
Leaving 271 "orphan"
Resolve chain of rel-canonical. Fix links that point to example
that themselves point to gallery.
/gallery/path/to/verryuniquename.html
/example/old/location/verryuniquename.html -> matplotlib.org/gallery/path/to/verryuniquename.html
/2.0.2/example/old/location/verryuniquename.html -> should point to /example/....
make it point to /gallery/....
No files with existing rel=canonical have been touched. This will
likely only affect pre-3.0 documentation files.
Obviously scripted, but kind of ugly:
https://gist.github.com/Carreau/d2b3e36b65d4155827539ef462860444
I paid attension to avoid doing any other changes than adding a single line to target files; so can try to do changes.