reuixiy / hugo-theme-meme

😝 You can’t spell awesome without MemE!
https://io-oi.me/hugo-theme-meme
MIT License
1.01k stars 279 forks source link

Netlify 部署后导航栏跳转失效 #459

Closed HushWay closed 5 months ago

HushWay commented 5 months ago

你好,谢谢你提供这么漂亮的主题。不过我遇到一个问题,是这样,我在本地配置与测试的网站一切正常。但是通过 github 导入 Netlify 部署后,导航栏点击没有反应。我查看了一下,导航栏链接的 href 属性是空。请问你知道原因吗? image

附录1:部署配置: image image

附录2:导航栏的配置是默认的,我没有修改过

[menu]
    ## 菜单栏
    # [[menu.main]]
    #     pageref = "/"
    #     name = "首页"
    #     weight = 1
    #     pre = "internal"
    #     post = "home"
    [[menu.main]]
        pageref = "/posts/"
        name = "文章"
        weight = 2
        pre = "internal"
        post = "archive"
    [[menu.main]]
        pageref = "/categories/"
        name = "分类"
        weight = 3
        pre = "internal"
        post = "th"
    [[menu.main]]
        pageref = "/tags/"
        name = "标签"
        weight = 4
        pre = "internal"
        post = "tags"
    [[menu.main]]
        pageref = "/about/"
        name = "关于"
        weight = 5
        pre = "internal"
        post = "user-circle"
    [[menu.main]]
        weight = 6
        identifier = "theme-switcher"
    [[menu.main]]
        weight = 7
        identifier = "lang-switcher"
    # [[menu.main]]
    #     weight = 8
    #     identifier = "search"
    #     post = "search"
HushWay commented 5 months ago

会不会是版本问题?我本地使用的hugo是 v0.124.1,而 Netlify 使用的是 v0.85,而且部署时有警告:

9:57:27 AM: ────────────────────────────────────────────────────────────────
9:57:27 AM: ​
9:57:27 AM: $ hugo
9:57:27 AM: WARN 2024/03/30 01:57:27 Module "meme" is not compatible with this Hugo version; run "hugo mod graph" for more information.
9:57:27 AM: Start building sites …
9:57:27 AM: hugo v0.85.0-724D5DB5+extended linux/amd64 BuildDate=2021-07-05T10:46:28Z VendorInfo=gohugoio
9:57:27 AM:                    | ZH-CN
9:57:27 AM: -------------------+--------
9:57:27 AM:   Pages            |    16
9:57:27 AM:   Paginator pages  |     0
9:57:27 AM:   Non-page files   |     0
9:57:27 AM:   Static files     |    11
9:57:27 AM:   Processed images |     0
9:57:27 AM:   Aliases          |     1
9:57:27 AM:   Sitemaps         |     1
9:57:27 AM:   Cleaned          |     0
9:57:27 AM: Total in 132 ms
9:57:27 AM: ​
9:57:27 AM: (build.command completed in 164ms)
9:57:27 AM: ​
9:57:28 AM: (Netlify Build completed in 523ms)
9:57:28 AM: Section completed: building
9:57:30 AM: Finished processing build request in 23.921s
HushWay commented 5 months ago

我已经解决了这个问题,就是因为netlify默认的版本太低导致的,添加netlify.toml文件指定hugo版本即可解决

[build.environment]
  HUGO_ENV = "production"
  HUGO_VERSION = "0.124.1"