代码之家  ›  专栏  ›  技术社区  ›  Darian Hickman

什么是雨果PermaLink格式,以完全匹配博主PermaLink格式?

  •  0
  • Darian Hickman  · 技术社区  · 7 年前

    我正试图从博客迁移到谷歌应用引擎上的雨果。我尝试重新生成的示例URL:

    https://www.darianhickman.com/2017/03/one-year-of-uber-lyft-2016-5300.html

    在config.toml文件中,我正在尝试:

    [permalinks]
      post  = "/:year/:month/:title.html"
    

    它很接近但失败了。雨果生成的URL示例:

    http://localhost:1313/2017/03/one-year-of-uber--lyft-2016-5300.html/

    Hugo的默认行为是使用index.html将文章发布到文件夹中。我需要改变什么?

    1 回复  |  直到 7 年前
        1
  •  2
  •   Jos    7 年前

    Hugo的默认行为是使用index.html将文章发布到文件夹中。我需要改变什么?

    在配置文件中(通常命名为 config.toml )您需要启用名为“丑陋的URL”的功能,如下所示:

    uglyURLs = true
    

    这样做可以使雨果以 /my-post.html .默认情况下,雨果会 index.html 你提到的文件 /my-post/ URL类型。