首页 > 解决方案 > 与 Blogger 永久链接格式完全匹配的 Hugo 永久链接格式是什么?

问题描述

我正在尝试从 Blogger 迁移到托管在 Google App Engine 上的 Hugo。我正在尝试重建的示例网址:

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

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

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

它很接近但失败了。示例 Hugo 生成的 url:

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

Hugo 的默认行为是将帖子放入带有 index.html 的文件夹中。我需要改变什么?

标签: bloggerpermalinkshugo

解决方案


Hugo 的默认行为是将帖子放入带有 index.html 的文件夹中。我需要改变什么?

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

uglyURLs = true

这样做会使 Hugo 以/my-post.html. 默认情况下,Hugo 会将index.html您提到的那些文件/my-post/作为 URL 类型。


推荐阅读