[英]How to keep pages with .html suffix in eleventy (static site gen) output?
我有一個現有的老式純 html 靜態網站,我想用 SSG 進行改造,我選擇了 11。
網站的結構是這樣的:
+ index.html
+ somepage.html
+ otherpage.html
如https://www.11ty.dev/docs/permalinks/#cool-uris-dont-change 所述,十一將創建:
+ index.html
+ somepage/index.html
+ otherpage/index.html
我不想更改我已經擁有的(不)酷的 URI :-)
我知道我可以在服務器上添加一個 .htaccess 重寫來重寫 URL。
但是不是可以配置 110 來保持舊站點的確切結構嗎? 我是這么認為的,但在文檔中沒有找到。
這已經回答了pdehaan上https://github.com/11ty/eleventy/issues/913一個鏈接到https://github.com/pdehaan/11ty-dynamic-permalink-test/
.eleventy.js
module.exports = (eleventyConfig) => {
return {
dir: {
input: "src",
output: "www"
}
};
};
src/pages/pages.11tydata.json
{
"permalink": "{{ page.fileSlug }}.html"
}
這是源目錄結構
src/
└── pages/
├── index.html
├── otherpage.html
├── pages.11tydata.json
└── somepage.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.