Static output always writes `foo.html`, so trailing-slash URLs 404 on hosts like GitHub Pages
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 42/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- typescript, vite
- Domínio
- build-system, devops
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- TypeScript
- Estrelas
- 580
- Forks
- 56
- Merge médio
- 11h 32min
- PRs com merge (30d)
- 158
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de voidzero-dev/void
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 57/100
voidzero-dev/void#636 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 67/100
voidzero-dev/void#635 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
voidzero-dev/void#627 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
voidzero-dev/void#619 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
voidzero-dev/void#606 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de voidzero-dev/void
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
better-auth/better-auth#12132 · 1 reação ·
Mantenedores costumam responder em até 1 dia
-
o8 next debug build aborts on Glass to Dark appearance switch (nil identifier messaged before check)Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
hurttlocker/o8#5112 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
webrecorder/wabac.js#386 ·
-
needs-triage
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 92/100
agent-of-empires/agent-of-empires#5098 · 1 comentário · 1 reação ·
Mantenedores costumam responder em até 1 dia