angular / angular/angular-cli

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

オープン
#29,173 コメント 5 件 リアクション 16 件 担当者 0 名 GitHub で見る
angular/build:application area: @angular/build area: @angular/ssr feature feature: insufficient votes
主要言語
TypeScript
スター
27k
フォーク
11.8k
平均マージ
14時間 23分
マージ済み PR(30日)
162

説明

### 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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Angular CLI の prerendering エントリポイントから開始し、ネストされたルートの出力に関する既存のテストを確認します。現在の index.html のレイアウトを確認したうえで、デフォルトの動作を維持しながらフラットな route.html のレイアウトを生成するオプションを定義し、検証します。

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

評価

技術スタック
angular, typescript
領域
build-system
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
42/100

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

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