[Feature][SEO] Allow strict and case sensitive paths#3448
[Feature][SEO] Allow strict and case sensitive paths#3448MitsuhaKitsune wants to merge 2 commits intonuxt:devfrom
Conversation
bd1e2c9 to
1466968
Compare
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
lib/common/utils.js
Outdated
There was a problem hiding this comment.
Maybe extract them into a options parameter is better for future extensible.
There was a problem hiding this comment.
Done, I group all options on cfe2c73#diff-b0dc205b0a1997433272d8c3ea0f5e86R312
lib/common/utils.js
Outdated
There was a problem hiding this comment.
How about adding a option for this behavior for not affecting legacy functionality.
There was a problem hiding this comment.
Yes you are right, I add routeCreationOptions.autoTrailingSlashSubfolders for not affect legacy funcionality
1466968 to
cfe2c73
Compare
lib/common/utils.js
Outdated
There was a problem hiding this comment.
Name to be options or use destructuring assignment should be more appropriate.
There was a problem hiding this comment.
Now I use there a destructuring assignment as you recomend, but I don't know if I do it fine, it's the first time that I use it as function arguments
lib/common/options.js
Outdated
There was a problem hiding this comment.
How about use routesOptions and make strictRegexPaths and caseSensitivePaths be pathToRegexpOptions as same as route config .
routesOptions: {
//{strict: {true|false}, sensitive: {true|false}}
pathToRegexpOptions: undefined,
trailingSlash: false
}Another important thing is that you should develop based on dev branch which options.defaults has been moved to lib/common/options.
There was a problem hiding this comment.
Sorry I push to 1.x because I think that dev branch it's the comming 2.x, I gona rebase the PR on dev branch with your recomendations
cfe2c73 to
6af1b75
Compare
…d content issues Resolve nuxt#3100
6af1b75 to
607a32e
Compare
|
@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. |
|
@MitsuhaKitsune |
|
@clarkdo, not sure why I was mentioned here :/ |
|
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 |
|
@atinux @MitsuhaKitsune @miljan-aleksic |
|
Hi @atinux 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. Explained on https://www.rocketclicks.com/client-education/canonical-tag-guide-choosing-canonical-vs-redirect/ 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 ^^ |
|
Okay, seems enought reasons for don't merge this PR, sorry for the inconveniences |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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:
Example scenario
Files:
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):