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

オープン
#240 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript, next.js

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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).
主要言語
JavaScript
スター
44
フォーク
44
PR マージ指標
30日以内にマージされた PR はありません

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

gofr-dev/website のほかの issue

gofr-dev/website の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。