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

Improve canonical path for vision in Google #748

Merged
merged 3 commits into from
Mar 28, 2019
Merged

Conversation

ivan-nginx
Copy link
Member

@ivan-nginx ivan-nginx commented Mar 28, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our guidelines.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for new features).

PR Type

What kind of change does this PR introduce?

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build related changes.
  • CI related changes.
  • Documentation content changes.
  • Other... Please describe: improvement

What is the current behavior?

Pages must placed in subdirectories with index.html names, e.g. source/docs/troubleshooting/index.md for pretty path with canonical option enabled:
image

But if we want to use pages in root directories and named as is with *.html suffix, source/docs/advanced-settings.md, canonical path will contain *.html suffix:
image

What is the new behavior?

From now all links will be not only without index.html, but without .html too for pretty path with canonical option enabled. And not need to set permalink in each page for that.

Pages now can placed in root directories and named as is with *.html suffix, e.g. source/docs/advanced-settings.md:
image

How to use?

In local servers *.html suffix will be exists. For remove they in Production, need to create redirects (for Nginx) or use advanced settings in deployment services (like «Pretty URLs» in Netlify):
image

Does this PR introduce a breaking change?

  • Yes.
  • No.

From now all links will be not only without 'index.html', but without `.html` too.
@1v9
Copy link
Member

1v9 commented Mar 28, 2019

For links contain html like https://1v9.im/post/theme-next-added-today's-poetry.html
canonical will be: <link rel="canonical" href="https://1v9.im/post/theme-next-added-today's-poetry">

My conf:

permalink: post/:uniq.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
title: {{ title }}
date: {{ date }}
tags: []
uniq:
categories:
comments: true
quicklink: false
---

@ivan-nginx
Copy link
Member Author

ivan-nginx commented Mar 28, 2019

For links contain html like https://1v9.im/post/theme-next-added-today's-poetry.html
canonical will be: <link rel="canonical" href="https://1v9.im/post/theme-next-added-today's-poetry">

I just updated readme, reread it.

@stevenjoezhang stevenjoezhang self-requested a review March 28, 2019 11:54
Copy link
Contributor

@stevenjoezhang stevenjoezhang left a comment

Choose a reason for hiding this comment

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

Oh, yes, netlify did the redirect on the server side... It's OK to do so

@ivan-nginx ivan-nginx merged commit 9af9287 into master Mar 28, 2019
@ivan-nginx ivan-nginx deleted the imp-canonical branch March 28, 2019 12:27
ivan-nginx added a commit to theme-next/theme-next.org that referenced this pull request Mar 28, 2019
@ivan-nginx ivan-nginx mentioned this pull request Mar 28, 2019
@liolok liolok changed the title Improved canonical path for vision in Google. Improve canonical path for vision in Google Mar 31, 2019
tongluyang pushed a commit to tongluyang/hexo-theme-next that referenced this pull request Nov 19, 2019
* Improved canonical path for vision in Google.

From now all links will be not only without 'index.html', but without `.html` too.

* Changed links in tag plugins.

* Changed links in config.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants