angular / angular/angular-cli

SSG/Prerendering: Allow generating foo.html instead of foo/index.html

Ouverte
#29,173 5 commentaires 16 réactions 0 personnes assignées Voir sur GitHub
angular/build:application area: @angular/build area: @angular/ssr feature feature: insufficient votes
Langage dominant
TypeScript
Étoiles
27k
Forks
11.8k
Merge moyen
14 h 23 min
PR mergées (30 j)
162

Description

### Description

Angular's Prerendering puts nested routes into a subfolder with `index.html`:
*=> Route `blog/myslug` becomes `blog/myslug/index.html`*

**The web server adds a trailing slash (for the folder) which is then removed by the Angular router, and it leads to an initial redirect.**

### Describe the solution you'd like

Some static site generators allow to create a flat structure instead with no subfolder:
*=> Route `blog/myslug` becomes `blog/myslug.html`*

**Proposed solution:**
- Output `myslug/index.html` by default, it is the most compatible output that works on each and every web server
- add an option for flat output (`myslug.html`) that can be used if I know my web server supports this

### Context

- Jekyll always outputs `myslug.html`
- [Nuxt v2 has an option](https://nuxt.com/deploy/cloudflare#route-matching)
- [Next.js has an option](https://nextjs.org/docs/app/api-reference/config/next-config-js/trailingSlash)

Most cloud hosting providers allow to serve `myslug.html` under `myslug`:
- GitHub Pages
- Cloudflare Pages
- [Firebase Hosting](https://firebase.google.com/docs/hosting/full-config#control_html_extensions)
- [Vercel](https://vercel.com/docs/projects/project-configuration#cleanurls)
- [Netlify](https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash)

Further read on trailing slash and framework/provider support: https://bjornlu.com/blog/trailing-slash-for-frameworks

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Commencez par le point d’entrée du prerendering de Angular CLI et examinez les tests existants pour la sortie des routes imbriquées. Confirmez la structure actuelle de index.html, puis définissez et vérifiez une option qui produit une structure plate de route.html tout en préservant le comportement par défaut.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
angular, typescript
Domaine
build-system
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
42/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.