Static output always writes `foo.html`, so trailing-slash URLs 404 on hosts like GitHub Pages
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- typescript, vite
- Área
- build-system, devops
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 580
- Forks
- 56
- Merge medio
- 12 h 10 min
- PR fusionados (30 d)
- 163
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de voidzero-dev/void
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
voidzero-dev/void#645 ·
Los mantenedores suelen responder en 1 día
-
void deploy cannot deploy a Worker with no URL after its first deploy, and --atomic refuses itAbierto
Dificultad 4/5 1-2 días Aptitud para principiantes 48/100
voidzero-dev/void#644 ·
Los mantenedores suelen responder en 1 día
-
React: `action()` and `router.visit()` never resolve when awaited in a transitionPosiblemente ocupada @cpojer la tomó hace 1 día. Abierto
voidzero-dev/void#643 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
voidzero-dev/void#636 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 67/100
voidzero-dev/void#635 ·
Los mantenedores suelen responder en 1 día
Todos los issues de voidzero-dev/void
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Los mantenedores suelen responder en 2 días
-
BeOS .json missingAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDictPosiblemente ocupada @yograj-vijay-yadav la tomó hoy. Abiertobug good first issue help wanted workshop
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
meteor/meteor#14919 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
marmelab/atomic-crm#401 ·
Los mantenedores suelen responder en 1 día
-
account: profile
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 5 días