What do dangerouslySetAllPagesToNoFollow
and dangerouslySetAllPagesToNoIndex
exactly do?
#1288
Unanswered
jaychang99
asked this question in
Q&A
Replies: 1 comment
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi everyone 🙂
I have been a big fan of
next-seo
and thank you for all the maintainers and @garmeeh for this wonderful library.I recently ran into an issue when using
dangerouslySetAllPagesToNoFollow
anddangerouslySetAllPagesToNoIndex
.Yes, I do know that in readme, we must use these two props carefully (hence the prefix
dangerously
), since as the name implies, it sets 'all' of the pages to not be followed, nor indexed.I was using this props in my
<DefaultSeo/>
in my_app.tsx
and my code pretty much looks like this:The code snippet above shows that I don't want my page to be indexed when the pathnames are
/contact-us
and/about
.So I expected my page to only be not indexed and followed on pages
/contact-us
, and/about
. (And in all the other pages except for these two have to be indexed)However, after deploying this code to my production server, my google search console warned me that it wasn't able to index the whole website (not these 2 specific pages) because of the
noindex
property.I was puzzled because the only two pages that should not be indexed are
/contact-us
and/about
. (These to pages were not listed on Disallowed list in robots.txt, FYI)How could this be? if the if statement was working correctly? Am I missing something out? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions