Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Static output always writes `foo.html`, so trailing-slash URLs 404 on hosts like GitHub Pages

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

メンテナーはふだん 1 日以内に返信

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript, vite

調査の方向性

Start with packages/void/src/prerender-render.ts, especially outputFileForPath, and compare its current path mapping with the GitHub Pages behavior described in the issue. Review the dev server's trailing slash redirect and the interaction with cloudflare.assets.html_handling in issue #580 before proposing the setting. Done means the output option, redirect behavior, and Cloudflare interaction have a documented and agreed direction.

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

説明

What happens

With output: 'static', every prerendered page except / is written as <path>.html (outputFileForPath in packages/void/src/prerender-render.ts). A section with an index page and child pages, such as

pages/posts/index.island.tsx
pages/posts/hello.md

builds to

dist/client/posts.html
dist/client/posts/hello.html

There is no option to write posts/index.html instead. Seen with Void 1.3.0; outputFileForPath is unchanged on current main.

Why it matters

The SSG guide says the static output works for self-hosting and covers hosting dist/client/ yourself. GitHub Pages doesn't map a trailing-slash URL to foo.html. I published the same layout on GitHub Pages (honbin/github-pages-trailing-slash, checked on 2026-10-29):

URL foo.html layout (Void today) foo/index.html layout
/posts 200 301 to /posts/
/posts/ 404 200
/posts/hello 200 301 to /posts/hello/
/posts/hello/ 404 200

So with Void's output, every trailing-slash URL except / returns 404, including /posts/, where posts.html sits next to a posts/ directory without an index.html. That breaks any site whose links and canonical URLs end with a slash. Cloudflare resolves both foo.html and foo/index.html (as noted in prerender-render.ts), so this doesn't show up with Void's own deploys.

Current workaround

We move the files in CI after vp build:

find dist/client -name '*.html' ! -name index.html ! -name 404.html | while read -r file; do
  mkdir -p "${file%.html}"
  mv "$file" "${file%.html}/index.html"
done

Related behavior

The dev server redirects /posts/ to /posts with a 301, so dev assumes URLs without a trailing slash. A directory-style output would probably need the dev redirect to follow the same choice.

Question

Would you be open to an option for directory-style static output (for example, a trailingSlash-like setting next to output: 'static')? Open points I can see:

  • the setting's name and where it lives
  • whether the dev server redirect follows it
  • how it combines with cloudflare.assets.html_handling (#580)

Happy to send a PR once the direction is clear.

主要言語
TypeScript
スター
580
フォーク
56
平均マージ
11時間 32分
マージ済み PR(30日)
158

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

voidzero-dev/void のほかの issue

voidzero-dev/void の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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