簡體   English   中英

如何在十一(靜態站點生成)輸出中保留帶有 .html 后綴的頁面?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM