我有一个现有的老派,纯html静态网站,我想用SSG改造,我选择了11。
网站的结构是这样的:
+ index.html
+ somepage.html
+ otherpage.html正如https://www.11ty.dev/docs/permalinks/#cool-uris-dont-change上所描述的,eleventy将创建:
+ index.html
+ somepage/index.html
+ otherpage/index.html我不想改变我已经拥有的(不)很酷的URI :-)
我知道我可以在服务器上添加.htaccess重写来重写URL。
但是,难道不可以配置11,这样它就可以保持旧站点的结构吗?我想是的,但在文档里找不到。
发布于 2020-02-09 16:57:03
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.htmlhttps://stackoverflow.com/questions/60119279
复制相似问题