LoveIt icon indicating copy to clipboard operation
LoveIt copied to clipboard

Page not found and baseURL

Open trmendes opened this issue 4 years ago • 4 comments

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?

trmendes avatar Mar 27 '20 19:03 trmendes

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.

dillonzq avatar Apr 27 '20 19:04 dillonzq

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 avatar May 07 '20 19:05 rguske

@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 👏

rguske avatar May 08 '20 06:05 rguske

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

AGou-ops avatar Sep 06 '21 03:09 AGou-ops