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

Server Islands get indexed by crawlers #12806

Open
1 task done
louisescher opened this issue Dec 21, 2024 · 4 comments · May be fixed by #12827
Open
1 task done

Server Islands get indexed by crawlers #12806

louisescher opened this issue Dec 21, 2024 · 4 comments · May be fixed by #12827
Labels
- P2: has workaround Bug, but has workaround (priority) feat: server islands Related to Server Islands (scope)

Comments

@louisescher
Copy link
Contributor

Astro Info

Astro                    v5.1.1
Node                     v22.5.1
System                   Linux (x64)
Package Manager          pnpm
Output                   static
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

Describe the Bug

Since v5.0.0, Server Islands are retrieved via GET request. This introduces an issue where crawlers (Googlebot and others) think that the server islands are pages, and try to index that page, which they fail to do. See this support thread on Discord for more information.

What's the expected result?

Server Islands should set the noindex HTTP header to indicate to crawlers that they shouldn't be indexed by default.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-fmzsdm7p?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 21, 2024
@JLarky
Copy link
Contributor

JLarky commented Dec 21, 2024

I was able to set noindex header from middleware, another option would be to be able to force POST method for server islands, maybe server:defer="POST"?

@louisescher
Copy link
Contributor Author

@JLarky That was the default behavior in Astro v4, but it introduces issues when trying to cache server islands, as the cache headers are ignored by all major browsers on POST requests. It would be easier to set the header anyways imo

@ematipico ematipico added - P2: has workaround Bug, but has workaround (priority) feat: server islands Related to Server Islands (scope) labels Dec 22, 2024
@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Dec 22, 2024
@Fakerko
Copy link

Fakerko commented Dec 23, 2024

I have the same problem, Google indexed my server islands as pages.

@louisescher how did you fixed it?

@louisescher
Copy link
Contributor Author

I have the same problem, Google indexed my server islands as pages.

@louisescher how did you fixed it?

Hi there! You can either:

  1. Add the server islands to your robots.txt file or
  2. Add the X-Robots-Tag header using Astro.response.headers.set in the frontmatter of the island and set it to noindex

@sinskiy sinskiy linked a pull request Dec 24, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority) feat: server islands Related to Server Islands (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants