SSG/Prerendering: Allow generating foo.html instead of foo/index.html
- 主要語言
- TypeScript
- 星號
- 27k
- 分支
- 11.8k
- 平均合併
- 14 小時 23 分鐘
- 30 天內合併 PR
- 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