Skip to content

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

Closed

Conversation

petebacondarwin
Copy link
Contributor

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

@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer comp: aio labels Feb 2, 2018
@petebacondarwin
Copy link
Contributor Author

I tried and tried to find a way to test this automatically. I couldn't get Protractor to give me access to test the head tag before the Angular application took over.

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.

@mary-poppins
Copy link

You can preview c3f94ba at https://pr21992-c3f94ba.ngbuilds.io/.

@petebacondarwin petebacondarwin added the target: patch This PR is targeted for the next patch release label Feb 2, 2018
@@ -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;
Copy link
Member

Choose a reason for hiding this comment

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

😱

Copy link
Contributor

Choose a reason for hiding this comment

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

🙀

Copy link
Contributor Author

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 :-)

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';
Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

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';
Copy link
Contributor

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.

@IgorMinar IgorMinar added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 3, 2018
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
@mary-poppins
Copy link

You can preview 35a9ea1 at https://pr21992-35a9ea1.ngbuilds.io/.

alxhub pushed a commit that referenced this pull request Feb 5, 2018
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

PR Close #21992
@alxhub alxhub closed this in 5a624fa Feb 5, 2018
@petebacondarwin petebacondarwin deleted the aio-preemptive-noindex branch February 5, 2018 22:44
jbogarthyde pushed a commit to jbogarthyde/angular that referenced this pull request Feb 23, 2018
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
leo6104 pushed a commit to leo6104/angular that referenced this pull request Mar 25, 2018
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
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aio: dynamically add the pre-emptive noindex
5 participants