-
Notifications
You must be signed in to change notification settings - Fork 26.2k
feat(aio): dynamically, pre-emptively, add noindex
#21992
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
feat(aio): dynamically, pre-emptively, add noindex
#21992
Conversation
I tried and tried to find a way to test this automatically. I couldn't get Protractor to give me access to test the I have manually checked that the tags are added before the Angular app bootstraps and that the Angular app removes (or leaves) them when the doc-viewer settles. I also manually checked that if an error occurs in bootstrap of the Angular app, the tags are not removed. |
You can preview c3f94ba at https://pr21992-c3f94ba.ngbuilds.io/. |
aio/src/index.html
Outdated
@@ -31,6 +31,15 @@ | |||
<meta name="apple-mobile-web-app-capable" content="yes"> | |||
<meta name="apple-mobile-web-app-status-bar-style" content="translucent"> | |||
|
|||
<script> | |||
// Dynamically, pre-emptively, add `noindex`, which will be removed when the doc is ready and valid | |||
debugger; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I told you I tested it manually :-)
aio/src/index.html
Outdated
debugger; | ||
var tag = document.createElement('meta'); tag.name = 'googlebot'; tag.content = 'noindex'; | ||
document.head.appendChild(tag); | ||
tag = document.createElement('meta'); tag.name = 'robots'; tag.content = 'noindex'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this intentional? I thought we didn't want to mess with other bots, only googlebot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we should treat googlebot differently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I only made the "static" meta tags Google only because I didn't believe that the other crawlers would be clever enough to realise that we might be removing it later via JS. As it turned out, even the Googlebot is not clever enough to do this either, which makes sense... as soon as you see the tag in the HTML why bother using extra resources to run the JS if it is already tagged as not indexable.
That being said, I am still not convinced that the crawler will not just bail out of indexing as soon as it sees that we have attached the noindex tag (even dynamically). We shall wait and see.
aio/src/index.html
Outdated
debugger; | ||
var tag = document.createElement('meta'); tag.name = 'googlebot'; tag.content = 'noindex'; | ||
document.head.appendChild(tag); | ||
tag = document.createElement('meta'); tag.name = 'robots'; tag.content = 'noindex'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we should treat googlebot differently.
These tags are removed when the doc is ready and valid, but this will allow us to block indexing in the case that the Angular app fails to bootstrap or load the document for some non-404 reason. This should get around the problem with hardcoded tags. See angular@c3fb820 Closes angular#21941
c3f94ba
to
35a9ea1
Compare
You can preview 35a9ea1 at https://pr21992-35a9ea1.ngbuilds.io/. |
These tags are removed when the doc is ready and valid, but this will allow us to block indexing in the case that the Angular app fails to bootstrap or load the document for some non-404 reason. This should get around the problem with hardcoded tags. See angular@c3fb820 Closes angular#21941 PR Close angular#21992
These tags are removed when the doc is ready and valid, but this will allow us to block indexing in the case that the Angular app fails to bootstrap or load the document for some non-404 reason. This should get around the problem with hardcoded tags. See angular@c3fb820 Closes angular#21941 PR Close angular#21992
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
These tags are removed when the doc is ready and valid, but this will
allow us to block indexing in the case that the Angular app fails to
bootstrap or load the document for some non-404 reason.
This should get around the problem with hardcoded tags. See
c3fb820
Closes #21941