Empty page.md files are published and listed in the sitemap

Aperta
#240 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, next.js

Direzione di ricerca

Start with src/app/sitemap.js to see how fast-glob matches page files, then inspect the prebuild scripts and check-changelog.mjs for the existing check pattern. Add coverage for empty or front-matter-only page.md files under src/app; verify the sitemap excludes them and yarn build fails naming the file, while non-empty sitemap entries remain unchanged.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Summary

Any empty page.md under src/app (including the docs overlaid from gofr-dev/gofr at deploy time) is published as a route and listed in sitemap.xml. Today this publishes a blank page at https://gofr.dev/docs/quick-start/cli: HTTP 200, the site chrome with nothing in the content area, a generic title, and a sitemap entry that tells search engines to index it.

Cause

src/app/sitemap.js collects routes with fast-glob over src/app/**/page.md, page.jsx and page.tsx and adds every match; it never checks that the file has content. Next.js renders an empty Markdoc file as an empty page rather than failing the build, so nothing flags it.

The source file is docs/quick-start/cli/page.md in gofr-dev/gofr (zero bytes). Fixing that file is tracked in gofr-dev/gofr; this issue is about the website not publishing or indexing such pages in the first place.

Steps to reproduce

  1. curl -s -o /dev/null -w '%{http_code} %{size_download}\n' https://gofr.dev/docs/quick-start/cli gives 200 with only the page shell.
  2. curl -s https://gofr.dev/sitemap.xml | grep quick-start/cli shows the URL.

Expected behavior

An empty content file is not listed in the sitemap, and the build fails (or at least warns loudly) so it is noticed before deploy.

Proposed solution

  1. In sitemap.js, skip page.md files whose size is zero (or whose content is only front matter).
  2. Add a small check to the prebuild step (next to check-changelog.mjs) that fails the build when an empty page.md is found under src/app.

Acceptance criteria

  • An empty page.md is not in sitemap.xml.
  • yarn build fails with a message naming the empty file.
  • Non-empty pages are unaffected (sitemap URL count unchanged otherwise).
Lingua principale
JavaScript
Stelle
44
Fork
44
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di gofr-dev/website

Tutte le issue di gofr-dev/website

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.