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

Separate nofollow from noindex tag #117

Merged
merged 3 commits into from Nov 13, 2019

Conversation

nik-john
Copy link
Contributor

@nik-john nik-john commented Nov 11, 2019

Description of Change(s):

According to Google SEO Specs for the robots meta tag, noindex and nofollow values can be set separately. Currently, settings no-index automatically also sets nofollow as observed #77. A real world example is a website with an internal directory of links that the dev wants google to crawl but not index (no one wants the directory page to show up on the Google Search Results Page). Currently there is no good way of doing this in Next SEO.

This PR separates the two into their own props. As updated in the readme the behavior will be as follows:

noindex nofollow meta content of robots, googlebot
-- -- index,follow (default)
false false index,follow
true -- noindex,follow
true false noindex,follow
-- true index,nofollow
false true index,nofollow
true true noindex,nofollow

One thing that came to mind was that codebases that currently use next-seo and have set noindex to mean noindex,nofollow will have regression issues because when this PR is merged and the dev updates the version on their codebase,

<NextSeo noindex={true} />

will mean

<meta name="robots" content="noindex,follow"> //previously "noindex,nofollow"
<meta name="googlebot" content="noindex,follow"> //previously "noindex,nofollow"

which is necessarily not something that people might want.

Therefore we will need to mark this as a breaking change and require the user to update the above code to

<NextSeo noindex={true} nofollow={true} />

Copy link
Owner

@garmeeh garmeeh left a comment

Choose a reason for hiding this comment

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

👏 @nik-john very well thought out PR, thank you for the contribution.

Just a couple of typos and a suggestion for one more test, but I can add that later if you don't have time.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@@ -6,6 +6,7 @@ export default () => (
<>
<NextSeo
noindex={true}
nofollow={true}
Copy link
Owner

Choose a reason for hiding this comment

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

Could you add a quick check to seo.spec.js > SEO overrides apply correctly to ensure this being set correctly?

Copy link
Contributor Author

@nik-john nik-john Nov 13, 2019

Choose a reason for hiding this comment

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

@garmeeh I added nofollow to the spec already - do you want me to update it to go index,nofollow or noindex,follow?

Copy link
Owner

Choose a reason for hiding this comment

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

😅 Oh yeah, it was already set to nofollow my bad.

@nik-john
Copy link
Contributor Author

nik-john commented Nov 13, 2019

@garmeeh I've updated the description blurb as well as the README comments (should've caught the typos myself 🤦‍♂) Do let me know if you want anything else added to the tests

Btw, I really love the level of test coverage in this lib 💯

@garmeeh
Copy link
Owner

garmeeh commented Nov 13, 2019

😅 Ah no worries, I would be surprised if there is not a few typos in the docs from myself.

Copy link
Owner

@garmeeh garmeeh left a comment

Choose a reason for hiding this comment

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

Looks good to me 💪

@garmeeh
Copy link
Owner

garmeeh commented Nov 13, 2019

@all-contributors please add @nik-john docs, code, test

@allcontributors
Copy link
Contributor

@garmeeh

I've put up a pull request to add @nik-john! 🎉

@garmeeh garmeeh merged commit 5836119 into garmeeh:master Nov 13, 2019
@garmeeh
Copy link
Owner

garmeeh commented Nov 13, 2019

@nik-john 🎉 next-seo@v3.0.0 has been released.

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

Successfully merging this pull request may close these issues.

None yet

2 participants