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

Themes: Add a canonical_url option #4193

Closed
wants to merge 3 commits into from
Closed

Themes: Add a canonical_url option #4193

wants to merge 3 commits into from

Conversation

Blendify
Copy link
Contributor

Subject: Provide better SEO for themes

Feature or Bugfix

  • Feature

Purpose

A canonical url will let search engines know they should give higher ranking to latest version of the docs. The url points to the root of the documentation and requires a trailing slash.

A canonical url will let search engines know
they should give higher ranking to latest version of the docs.
The url points to the root of the documentation and requires a trailing
slash.
doc/theming.rst Outdated
they should give higher ranking to latest version of the docs. The url
points to the root of the documentation and requires a trailing slash.

.. cronical url: https://en.wikipedia.org/wiki/Canonical_link_element
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you build this document ever? A hyperlink target should start with underscore. And this also has a typo. Please check them please.

BTW, I prefer to use RFC 6596 instead. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not have a strong preference either way, but I think using the RFC 6596 link could be too technical for some.

@@ -116,6 +116,12 @@ These themes are:

- **sidebarwidth** (an integer): Width of the sidebar in pixels. (Do not
include ``px`` in the value.) Defaults to 230 pixels.

- **canonical_url** (sting): A `canonical url`_ to let search engines know
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about canonical_baseurl instead? I believe this is a part of URL, So baseurl is better for me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason that I used canonica_urll is that a couple 3rd party themes already have this feature and use that variable instead so it will be easier for them to preserve compatibility without having to leave there own variable in their theme.

@@ -7,3 +7,4 @@ pygments_style = none
nosidebar = false
sidebarwidth = 230
navigation_with_keys = False
canonical_url =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you wan to this as an option of HTML themes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apposed to adding it to the HTML builder?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for late response. Yes, I meant that. I think the responsibility of HTML theme is look and feel, and canonical URL is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will look into that.

@@ -139,6 +139,9 @@
{%- block scripts %}
{{- script() }}
{%- endblock %}
{%- if theme_canonical_url %}
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can change the suffix of the HTML files through html_file_suffix. So we have to use variable to represent the name of file extension.

@tk0miya tk0miya added type:enhancement enhance or introduce a new feature builder:html type:proposal a feature suggestion labels Oct 29, 2017
@tk0miya tk0miya added this to the 1.7 milestone Oct 29, 2017
@Blendify
Copy link
Contributor Author

Poke

@shimizukawa
Copy link
Member

FYI. The code freeze day of 1.7 will come in a week.

Mid of Jan: Feature freeze, Call for translation and release 1.7b1
#4211 (comment)

@tk0miya
Copy link
Member

tk0miya commented Jun 6, 2018

I just made an alternative of this. Please check #5049 :-)

@tk0miya
Copy link
Member

tk0miya commented Jun 8, 2018

Merged #5049 instead.
Thank you for your work :-)

@tk0miya tk0miya closed this Jun 8, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:html type:enhancement enhance or introduce a new feature type:proposal a feature suggestion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants