dillonzq / LoveIt

❤️A clean, elegant but advanced blog theme for Hugo 一个简洁、优雅且高效的 Hugo 主题
https://hugoloveit.com
MIT License
3.42k stars 1.08k forks source link

Page not found and baseURL #206

Open trmendes opened 4 years ago

trmendes commented 4 years ago

I have to set my baseURL as

https://mygitlabuser.gitlab.io/mypage

in order to get access to the css files and the page to render correctly but now every time I click on a link from menu I get the mypage duplicated.

For example I click on about and I will have https://mygitlabuser.gitlab.io/mypage/mypage/about instead of https://mygitlabuser.gitlab.io/mypage/about

Or I click on posts and I get: https://mygitlabuser.gitlab.io/mypage/mypage/posts instead of https://mygitlabuser.gitlab.io/mypage/posts

Am I missing something on the configuration file?

dillonzq commented 4 years ago

Hi, @trmendes It's a bug in Hugo #4995. You can set complete absolute path in the menu part of your config to solve it temporarily.

rguske commented 4 years ago

Hi @dillonzq, I've migrated my old theme finally to your GREAT Loveit theme and I just can say, I love it ;-). I have one big issue but I cannot say if my issue is similar to this one here. All my old posts have the url "https://mydomain.com/post/my-first-post/" and now with the Loveit theme all url's changed to "https://mydomain.com/my-first-post/" (without /post/), which is basically good but because some of my post are documented/ bookmarked here and there I would love to change it, so that all the bookmarked posts (links) are working as expected. Would appreciate your input here. Thy Robert

rguske commented 4 years ago

@dillonzq I was to fast in posting my issue. It was easy to fix with permalinks.

# Permalinks config (https://gohugo.io/content-management/urls/#permalinks)
[Permalinks]
  # posts = ":year/:month/:filename"
  posts = "/post/:filename"

Again, awesome work 👏

AGou-ops commented 3 years ago

I have to set my baseURL as

https://mygitlabuser.gitlab.io/mypage

in order to get access to the css files and the page to render correctly but now every time I click on a link from menu I get the mypage duplicated.

For example I click on about and I will have https://mygitlabuser.gitlab.io/mypage/mypage/about instead of https://mygitlabuser.gitlab.io/mypage/about

Or I click on posts and I get: https://mygitlabuser.gitlab.io/mypage/mypage/posts instead of https://mygitlabuser.gitlab.io/mypage/posts

Am I missing something on the configuration file?

I have same issue, but I solved this problem by using absolute path(go back to upper level path). For example: I want visit https://example.com/subdir/posts/, just set url in config.toml like:

baseURL = "https://example.com/subdir"
......
    [languages.zh-cn.menu]
      [[languages.zh-cn.menu.main]]
        identifier = "posts"
        pre = ""
        post = ""
        url = "../subdir/posts/"                     # just use "../"
        title = ""
        weight = 1