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

Added additional head tag to noindex, follow the search page #3233

Closed

Conversation

jcomack
Copy link
Contributor

@jcomack jcomack commented Aug 7, 2020

Motivation

Ensures that search pages can't get indexed by search engines, as this is considered bad UX when coming from a search engine such as Google

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  • Check out this PR, build and start the development server
  • Navigate to http://localhost:3000/search
  • Check the source of the page. You should see a <meta name="robots" content="noindex, follow" /> tag in the <head> section.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@jcomack jcomack requested a review from yangshun as a code owner August 7, 2020 08:14
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Aug 7, 2020
@docusaurus-bot
Copy link
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 0266576

https://deploy-preview-3233--docusaurus-2.netlify.app

Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

not a good idea to apply globally

you can do this by using @docusaurus/Head (Helmet wrapper) directly on the search page instead

name: 'robots',
content: 'noindex, follow',
},
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Unfortunately this adds noindex nofollow to ALL the docusaurus site, not just search.

Copy link

Choose a reason for hiding this comment

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

How do we do it just to search? That's what we want.

And I don't understand why this isn't a good idea to do for all search results pages using Docusaurus, as that's long been the recommendation of all major search engines.

Copy link
Collaborator

@slorber slorber Aug 11, 2020

Choose a reason for hiding this comment

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

Because this change does not prevent indexing the search page, it prevents indexing ALL the documentation website (ie the website would disappear from Google, very bad!).
It has never been advised by search engines to not index anything at all.

How to apply this only to a single page? Not through the config, but on the page itself you can use this declarative component:

https://v2.docusaurus.io/docs/docusaurus-core#head

Read the doc of React helmet to understand how it works.

I can't provide much more help because helping you contributing this change would take me more time than doing it myself :) If you want me to do it tell me, otherwise you can edit your PR

Copy link

Choose a reason for hiding this comment

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

@slorber I wasn't the one doing the pull, my colleague @jcomack did that, but I think he thought (as I do, reading his code) that he's just changing the theme of the search page. If it doesn't, then by all means do the change that makes it just noindex the search results page :)

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2020

Hey @jcomack @dejakob can you please review this other PR?
#3263

Is the preview using the correct meta tags on the correct pages? thanks

@slorber slorber closed this Aug 11, 2020
@dejakob
Copy link
Contributor

dejakob commented Aug 11, 2020

The PR is closed already?

@slorber
Copy link
Collaborator

slorber commented Aug 11, 2020

oh sorry @dejakob wanted to ping @jdevalk instead :)

The PR is => #3263

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

Successfully merging this pull request may close these issues.

None yet

6 participants