GitHub Pages publishes the whole repo: dev files and stray Jekyll pages

Offen Anfängerfreundlich
#75 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
72/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
github
Bereich
devops

Rechercherichtung

Das Problem ist, dass der GitHub-Pages-Build jede versionierte Datei veröffentlicht. Beginne im Repository-Stammverzeichnis, wo eine _config.yml liegen würde, und prüfe sw.js auf die Liste der Dateien, die das Spiel benötigt, bevor du etwas ausschließt. Lies den Abschnitt Deployment in README.md und bestätige, dass index.html die einzige Seite ist, die ausgeliefert werden soll. Fertig ist es, wenn die Pfade aus den Akzeptanzkriterien (package.json, tests/unit/ai.test.js, README.md, CHANGELOG.html) auf der Live-Seite 404 liefern, das Spiel und jede Datei in sw.js weiterhin 200 liefern und das Spiel weiterhin offline funktioniert.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

enhancement good first issue severity: low

Summary

GitHub Pages builds the site from the root of main with Jekyll, so every tracked file is published, not only the game. Dev files are served, and each Markdown file becomes an unlinked, GitHub-themed page titled "Static_Chess" that search engines can index next to the game.

Where

  • Pages settings: source main / (root), legacy (Jekyll) build
  • No _config.yml and no .nojekyll in the repository root
  • index.html:1 (the only page that is meant to be the site)

Details

Checked on the live site at 0144de7. All of these return 200:

URL path What it is
/package.json, /package-lock.json (203 KB), /eslint.config.mjs dev tooling
/tests/unit/ai.test.js, /tests/helpers/load-game.js (and the rest of tests/) test suite
/README.md, /CHANGELOG.md, /docs/ARCHITECTURE.md raw Markdown
/CHANGELOG.html, /docs/ARCHITECTURE.html, /docs/ROADMAP.html, /docs/RELEASE.html, /releases/, /releases/RELEASE_NOTES_v0.1.0.html, /releases/RELEASE_NOTES_v0.2.0.html, /releases/RELEASE_GUIDE_v0.1.0.html Jekyll-rendered pages

The rendered pages use GitHub's default theme, not the game's styles. Their heading is the repository name Static_Chess, their <title> ends in | Static_Chess, and each one requests /Static_Chess/favicon.ico, which is a 404. Nothing on the game page links to them.

Nothing sensitive is exposed: the repository is public and these files are the same ones visible on GitHub.

Impact

  • Search engines can index eight off-brand pages and the raw Markdown as part of the site.
  • Every push to main runs a Jekyll build over files that are not part of the game.
  • Anything added to the repository later is published automatically, whether or not it was meant to be.

Steps to reproduce

  1. Open https://tmhsdigital.github.io/Static_Chess/CHANGELOG.html.
  2. Open https://tmhsdigital.github.io/Static_Chess/package-lock.json.

Suggested fix

Smallest change: add a _config.yml at the repository root that excludes everything that is not the game, for example:

exclude:
  - README.md
  - CHANGELOG.md
  - docs
  - releases
  - tests
  - package.json
  - package-lock.json
  - eslint.config.mjs

Alternative: deploy with a GitHub Actions workflow that uploads only index.html, css/, js/, assets/, manifest.webmanifest and sw.js, and switch the Pages source to "GitHub Actions". This is more work and needs a settings change by a maintainer, but it publishes an explicit list instead of an exclusion list.

Acceptance criteria

  • /package.json, /package-lock.json, /tests/unit/ai.test.js, /README.md and /CHANGELOG.html return 404 on the live site
  • The game at / and every file listed in sw.js still return 200
  • The game still installs and opens offline

Getting started

  • Relevant files: index.html, sw.js (the list of files the game needs), README.md (Deployment section)
  • How to run tests: npm test, npm run lint, npm run format
  • Related docs: GitHub Pages documentation on configuring Jekyll and on custom workflows

Filed by repo-audit/pages-audit at 0144de7. Severity: low. Effort: S. audit-key: enhancement|index.html|pages-published-files

Vorherrschende Sprache
JavaScript
Sterne
4
Forks
2
Ø Merge
4 Std. 8 Min.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus TMHSDigital/Static_Chess

Alle Issues in TMHSDigital/Static_Chess

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.