Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[Feature][SEO] Allow strict and case sensitive paths #3448
Actually nuxt.js have a duplicated content issue on generated routes, you can access to same page on diferent url's variations like: '/news', '/news/', '/News', '/NeWS/', etc etc...
This is bad practice for SEO and it's penalized by search engines, with this modification nuxt.js allow set strict and case sensitive routes with some options on nuxt.config.js inside router section:
Generated routes urls (should match exactly, any diference on path didnt meet the route, except the fourth url that it's dinamic but still working only without final slash):
@@ Coverage Diff @@ ## dev #3448 +/- ## ========================================= - Coverage 99.1% 98.92% -0.18% ========================================= Files 18 18 Lines 1112 1116 +4 Branches 299 301 +2 ========================================= + Hits 1102 1104 +2 - Misses 10 12 +2
@clarkdo: Rebased to dev branch and applied all requested changes, sorry for the inconveniences.
Check if I do fine on https://github.com/nuxt/nuxt.js/pull/3448/files#diff-963dc90aa712aa2f54692cc2542c65feR248, it's the first time that I use destructuring assignments as function arguments.
I am not sure that adding a new option is the solution.
Actually we already talked about this before and you simply have to use the
You can see an implementation our our documentation website: https://github.com/nuxt/nuxtjs.org/blob/master/layouts/default.vue#L26
More information about canonical: https://support.google.com/webmasters/answer/139066?hl=en
I know how work the canonical metatags, but I think isn't a good practice for this case, canonical tags are usefull (or atleast indicative for some search engines) to prevent duplicated content issues on websites, but on another scenarios, think on a online shop for example, we have the following urls:
The three url's got the same content, a t-shirts product list, but the second and third url's are used to sort the list by price or alphabethical, the order of the list don't affect to similarity algorritm, these three url's gona get flagged as duplicated content, to prevent it, we can choose one of these three to get indexed, for example
On this example case, we need the three url's active, we don't have another way (except make dynamic and realtime filters without affect the url) so canonical meta tag help us on this case.
On the example case exposed on the pull request, we have a little news blog in our nuxt, we only need
(I can't find now article for this example case)
Note that on previous examples, I use the final trailing slash on some url's, the reason it's for identify the url as subfolder because have 'sub-url's inside', come back to the shop example, when we click one product of the list, we have a only single product page on
Explained on https://en.pedrodias.net/seo/trailing-slash-urls
I'm not a SEO expertise and I talking from my experience, as developer I help to website owners to improve their SEO and get better visibility on search engines reading a lot of SEO guides and asking on sites of SEO experts (a lot of time past of it, can't recover all links), it's possible that I wrong on some point, but for now all sites where I apply this things have a good SEO and don't recive any negative coment from their owners.
Note that I don't making any redirection, only I choose a unic and the best path for each route and make it strict, website users don't have affected with extra load time or redirections.
@clarkdo No problem, I didn't noticed that this case are reviewed on the past too, I gona wait for @Atinux decission, if he decide continue with this I upload the tests (I'm new on Node.js and I need learn how unit tests work first, I tried checking the current test, but I use npm not yarn, so I can't run the test through CLI commands on my PC).
Anyways thanks to both for this awesome project, I really love it and I gona still here to help when I can, and specially to you @clarkdo for the improvement tips and the time taked on check this, your tips are really usefull and I learn a bit from them ^^