I’d love for threads that are not tasks to be publicly indexable by google

merged…
osebo28d ago

I’d love for threads that are not tasks to be publicly indexable by google

3 repliesoldestnewest
Osebotfable-5-128d ago

Today every thread page ships robots: noindex (lib/site.ts previewMetadata was written for link previews only), and there is no robots.txt or sitemap, so Google can't index anything beyond the landing page.

Plan:

  1. Define "not a task" server-side the same way the thread page already decides whether to show run chrome (engaged, thread e028f9e0): a thread is a discussion thread when it has no jobs and no Osebot posts (PRs only ever come from Osebot posts, so that's covered). A thread is indexable when it's a discussion thread AND readable without a session (open workspace, public thread, or no workspace: threadReadable(t, null, false)).
  2. lib/previews.ts: ThreadPreview gets engaged + indexable; add listIndexableThreads() for the sitemap.
  3. lib/site.ts previewMetadata: an index option (default stays noindex for workspace manage / invite pages) that flips robots to index,follow and adds a canonical /threads/<id> so ?order=newest and #post-… links don't register as duplicates.
  4. app/threads/[id]/page.tsx passes index: t.indexable.
  5. New app/robots.ts (allow everything public, disallow /api, /workspaces (manage pages), /join, /signin, /settings, /embed; point at the sitemap) and app/sitemap.ts listing the indexable threads with lastModified. robots.txt / sitemap.xml are already reserved slugs in lib/slug.ts.

Task threads, and anything in a private workspace, stay noindex exactly as now.

Osebotfable-5-128d agothreadide@1cae5df

Done, pushed as 1cae5df on thread/53aab647.

What changed

  • Every thread page used to send robots: noindex, and there was no robots.txt or sitemap, so nothing but the landing page could be indexed.
  • Now a thread is indexable when both hold:
    1. it is a discussion thread: no job was ever queued and Osebot never posted (the same engaged test the thread page uses to hide run chrome, so "shows no Osebot stuff" = "Google may index it");
    2. anyone can read it without signing in: open workspace, public thread, or no workspace.
  • Indexable threads get <meta name="robots" content="index, follow"> plus a canonical /threads/<id> (so ?order=newest and #post-… links don't count as duplicates). Task threads and gated threads stay noindex exactly as before.
  • New /robots.txt (allow /; disallow /api/, /workspaces/, /join/, /signin, /settings, /embed/) and /sitemap.xml, built from the DB on each request, listing exactly the indexable threads. A thread drops out of the sitemap the moment someone asks Osebot in it.

Verified with the built app against a sandbox Postgres: discussion thread in an open workspace and a public discussion thread in a private workspace → index,follow + canonical and in the sitemap; task thread (queued job) in an open workspace → readable but noindex, not in the sitemap; private threads → 404 + noindex. tsc and next build pass.

Things to know

  • Workspace home pages (/<slug>) stay noindex; the sitemap handles discovery. If you'd like open workspace homes indexed too, that is a one-line index: w.open in app/[workspace]/page.tsx, say the word.
  • Vercel preview deployments add X-Robots-Tag: noindex themselves, so previews never leak into Google.
  • Once merged, submit https://evenings.forum/sitemap.xml in Google Search Console to get the first crawl going; Google won't pick up a new sitemap quickly on its own.
  • A thread that was indexed and later becomes a task flips to noindex on the next crawl; Google drops it then, not instantly.
Osebot28d ago

Merged threadide #172 by @osebo (merge, ccbda69).