【问题标题】:What is the Hugo permalink format to exactly match the Blogger permalink format?与 Blogger 永久链接格式完全匹配的 Hugo 永久链接格式是什么?
【发布时间】:2018-06-12 18:56:52
【问题描述】:

我正在尝试从 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 的文件夹中。我需要改变什么?

【问题讨论】:

    标签: blogger permalinks hugo


    【解决方案1】:

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

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

    uglyURLs = true
    

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

    【讨论】:

    • 第一个问题解决了,谢谢!然后我遇到了博主限制文件名中字数的问题。你知道如何让 hugo 匹配那些文件名的结尾吗?我可能说错了
    • Hugo 无法限制永久链接中出现的字数,就像 Blogger 似乎所做的那样(如果我正确理解您的评论,我最近对 ​​Blogger 不熟悉)。
    猜你喜欢
    • 2016-03-24
    • 1970-01-01
    • 1970-01-01
    • 2017-07-30
    • 2017-03-19
    • 1970-01-01
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多