Skip to content

ci: keep studio.geolibre.app out of search results - #1843

Closed
giswqs wants to merge 1 commit into
mainfrom
feat/studio-noindex
Closed

ci: keep studio.geolibre.app out of search results#1843
giswqs wants to merge 1 commit into
mainfrom
feat/studio-noindex

Conversation

@giswqs

@giswqs giswqs commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

The gated instance is meant to be reached by invitation, and nothing on it is useful to a crawler — every route renders the sign-in card until a session exists.

The deploy step now writes a robots.txt disallowing everything, and appends <meta name="robots" content="noindex, nofollow"> to <head>.

Why both, and the caveat

They deliberately do not compose. A crawler that honours the Disallow never fetches the page, so it never reads the noindex — which is why a URL linked from elsewhere can still be listed (bare, no title). The Disallow stops crawling; the meta covers crawlers that ignore robots.txt.

For this deployment that is the right trade: nothing links to studio.geolibre.app, so nothing should discover it in the first place. The inline comment records the switch to make if that ever changes — relax robots.txt to Allow: / so the noindex becomes the rule that applies.

Notes

  • The meta is appended to the end of <head> so the charset declaration keeps its place as the first thing in the document.
  • It is injected into generated markup, so the step greps for it afterwards and fails the run rather than publishing an indexable page if a future index.html stops matching the pattern.

Validation

Ran the exact sed against the real built apps/geolibre-desktop/dist/index.html: injected once, </head> count unchanged, charset still first, and the document still parses as <html> <head> </head> <body> </body> </html>. check-yaml and the full npm build pass.

Summary by CodeRabbit

  • New Features
    • Added search-engine blocking for deployed sites through robots.txt and noindex, nofollow metadata.
    • Deployments now verify that the search-engine exclusion settings are present before completing.

The gated instance is meant to be reached by invitation, and nothing on it is
useful to a crawler — every route renders the sign-in card until a session
exists.

Write a robots.txt disallowing everything, and append a noindex meta to
<head> for crawlers that ignore it. The two deliberately do not compose: a
crawler honouring the Disallow never fetches the page and so never reads the
noindex, which is why a URL linked from elsewhere can still be listed bare.
Noted inline, with the switch to make (relax robots.txt to Allow) if studio
is ever linked publicly.

The meta is injected into generated markup, so the step greps for it
afterwards and fails rather than publishing an indexable page if a future
index.html stops matching.
Copilot AI lite review requested due to automatic review settings August 11, 2026 02:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The studio deployment workflow now blocks crawler access, adds noindex, nofollow metadata to index.html, and verifies the metadata before deployment continues.

Changes

Deployment protection

Layer / File(s) Summary
Site preparation and validation
.github/workflows/studio-deploy.yml
The workflow creates robots.txt, injects a noindex, nofollow meta tag into index.html, and fails when the tag is missing.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • opengeos/GeoLibre#1842: Both changes modify the studio deployment workflow. This change adds crawler-blocking protections to that workflow.

Poem

A rabbit checks the site at night,
No crawler finds a page in sight.
robots.txt guards every door,
No-index tags protect the floor.
The build confirms the rule is true—
Then hops along to greener views.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing studio.geolibre.app from appearing in search results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/studio-noindex

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@giswqs giswqs closed this Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Cloudflare PR preview

Item Value
Site https://d349cf47.geolibre-preview.pages.dev
Demo app https://d349cf47.geolibre-preview.pages.dev/demo/
Commit f4db8e3

# to "Allow: /" so the noindex is the rule that applies.
# Appended to the end of <head> rather than the start, so the charset
# declaration keeps its place as the first thing in the document.
sed -i '0,/<\/head>/s// <meta name="robots" content="noindex, nofollow" \/>\n <\/head>/' index.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor/informational, low confidence: vite-plugin-pwa's workbox globPatterns includes html (see vite.config.ts around the workbox: block), so the service-worker precache manifest's revision hash for index.html is computed at build time from the pre-sed content. This sed runs after that build step, so the deployed index.html (with the noindex meta tag) will differ from what the manifest hashed.

In practice this is likely harmless — Workbox precaching fetches the resource by URL at install time rather than validating byte-for-byte against the revision hash, so the service worker should still end up caching the actual (modified) file. Flagging only because it's a subtle build-step-ordering interaction worth being aware of if precache behavior ever looks stale for this deployment specifically.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. The sed injection targets the first </head> only (via the 0,/pattern/ GNU sed idiom), correctly escapes / for the s/// delimiter, and the design's own grep -q 'name="robots"' index.html check — combined with the default bash -e -o pipefail shell GitHub Actions uses for multi-line run: blocks — genuinely fails the step if the substitution silently didn't match. Verified no pre-existing robots.txt in apps/geolibre-desktop/public/ and no pre-existing name="robots" meta anywhere in the app, so the grep check can't produce a false positive. Confidence: high.

Security: None applicable — static config/markup changes only, no user input, no new external hosts, no secrets touched.

Performance: None of note. Robots.txt/meta tag are trivially small relative to the existing 900 MB Pages size guard.

Quality: One low-confidence, informational note posted inline (.github/workflows/studio-deploy.yml:145): vite-plugin-pwa's workbox config precaches index.html (see vite.config.ts), and its revision manifest is computed at build time — before this sed step runs — so the deployed HTML differs from what the manifest hashed. Almost certainly harmless (Workbox fetches by URL rather than validating against the hash byte-for-byte), but worth being aware of if precache behavior for this deployment ever looks stale. Confidence: low.

CLAUDE.md: No violations. The added comments explain why (crawler behavior, injection ordering, fail-loudly rationale) rather than restating what, consistent with this repo's convention and the surrounding file's existing style.

Overall this is a well-scoped, carefully validated change (the PR body documents manual testing against the real built index.html), and I didn't find anything blocking.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 GitHub Pages PR preview

Item Value
Site https://opengeos.org/pages-preview/GeoLibre/pr-1843/
Demo app https://opengeos.org/pages-preview/GeoLibre/pr-1843/demo/
Commit f4db8e3

Note

GitHub Pages built this preview successfully, but its serving edge returned HTTP 403 when checked. The links may still be propagating.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/studio-deploy.yml:
- Around line 145-149: Strengthen the validation around the robots-tag injection
in the deployment workflow: record the number of </head> markers before and
after the sed edit and fail unless the count is unchanged, then validate that
exactly one meta element with name="robots" and content="noindex, nofollow"
exists inside the head rather than matching arbitrary text. Keep the deployment
blocked whenever the expected document structure or exact tag is absent.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: fe27d2ec-6401-489f-b806-d0042045054d

📥 Commits

Reviewing files that changed from the base of the PR and between fee927d and f4db8e3.

📒 Files selected for processing (1)
  • .github/workflows/studio-deploy.yml

Comment on lines +145 to +149
sed -i '0,/<\/head>/s// <meta name="robots" content="noindex, nofollow" \/>\n <\/head>/' index.html
# The tag is injected into generated markup, so fail loudly if a
# future index.html no longer matches rather than publishing an
# indexable page.
grep -q 'name="robots"' index.html

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Validate the exact tag and document structure before publishing.

At Line 149, grep -q 'name="robots"' only checks a substring. It can pass on an existing tag, a comment, or text outside <head>, even when Line 145 did not add the required noindex, nofollow tag. Line 145 also uses the first textual </head> occurrence instead of validating the parsed document. This can publish an indexable studio after a template change. Validate exactly one required meta element inside <head>, and compare the </head> count before and after the edit.

Suggested minimum guard
+          head_count_before=$(grep -oF '</head>' index.html | wc -l || true)
+          if [ "$head_count_before" -eq 0 ]; then
+            echo "::error::index.html has no </head> element."
+            exit 1
+          fi
           sed -i '0,/<\/head>/s//    <meta name="robots" content="noindex, nofollow" \/>\n  <\/head>/' index.html
-          grep -q 'name="robots"' index.html
+          head_count_after=$(grep -oF '</head>' index.html | wc -l || true)
+          robots_count=$(grep -oF '<meta name="robots" content="noindex, nofollow" />' index.html | wc -l || true)
+          if [ "$head_count_after" -ne "$head_count_before" ] || [ "$robots_count" -ne 1 ]; then
+            echo "::error::index.html failed robots meta validation."
+            exit 1
+          fi
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/studio-deploy.yml around lines 145 - 149, Strengthen the
validation around the robots-tag injection in the deployment workflow: record
the number of </head> markers before and after the sed edit and fail unless the
count is unchanged, then validate that exactly one meta element with
name="robots" and content="noindex, nofollow" exists inside the head rather than
matching arbitrary text. Keep the deployment blocked whenever the expected
document structure or exact tag is absent.

@giswqs
giswqs deleted the feat/studio-noindex branch August 12, 2026 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants