Help getting Hugo blog to display posts on gitlab pages

Hey Folks. I am trying to get a very simple blog running on gitlab pages. The hugo code works just fine when I build the blog locally, but for some reason I only see the main entry page when I go to the gitlab pages. Note that I write posts in Asciidoc format, so the posts are organized as .adoc files. I click on the “Posts” button, but then I just see a 404 error. The repository is public and all, so should not be a permissions issue.

I am not really sure how to provide the info in this post, to help debug. The repository itself is at ca_water_data / ca_water_data_blog · GitLab, and the corresponding gitlab page is https://ca_water_data.gitlab.io/ca_water_data_blog/ .

I am not sure how to look at the public folder, since that folder does not seem to be included in the repository files. So I can’t check the HTML to see if it is all there. According to gitlab-ci the pages are generated. I also made sure that the files were NOT in draft mode. But short of that, not sure where the error could be.

If anyone has any suggestions, please pass them along. I can provide additional info if that is helpful, or as I mentioned the repo is open for anyone to look at.

Note, here is my config.toml file.

baseURL = ""
languageCode = "en-us"
title = "California Water Data Challenge"
theme = "dimension"

pygmentsStyle = "colorful"
pygmentsUseClasses = false
pygmentsCodeFences = true

[markup.asciidocext]
    extensions = ["asciidoctor-html5s",
                  "asciidoctor-diagram",
                  "asciidoctor-bibtex"]
    workingFolderCurrent = true
    trace = true
    [markup.asciidocext.attributes]
        my-base-url = ""
        my-attribute-name = "California Water Data Challenge"

I tried to put the github.io site for the baseurl and my-base-url, but then I got a site where the theme was not applied.

I can share the gitlab-ci.yml if that will help. Not sure what else there is to show.

Hi there,

The Hugo docs has a section on deploying with GitLab: https://gohugo.io/hosting-and-deployment/hosting-on-gitlab/

Did you follow the steps there?

@pointyfar Thanks for pointing me to the documentation. Yep, I followed those steps. I can include a copy of my gitlab-ci.yml file in the OP if it will help. I probably should adjust the title of the OP to be that when the site is built to gitlab pages, I only see the main title page. When I click on the button or link for posts, I just get a 404 error. So for some reason the navigation is not working. I don’t know if that is a common issue or some sort of configuration step that I might have missed. But I did follow those steps in the guide.

Since I am new to hugo and not much of a web developer, the debugging is still a bit new to me. I can use hugo server -v --destination test and generate a temporary server that works correctly. The links for the posts are there and all is good. I have to try and generate the public site folder next and see if I can start a local webserver and get the same problem. So just trying to feel my way through. I was just surprised by the difference between the local server and then the deployed gitlab pages.

Thanks again. If you have any more thoughts or suggestions, please pass them along.

From the docs:

Make sure your baseURL key-value in your site configuration reflects the full URL of your GitLab pages repository if you’re using the default GitLab Pages URL (e.g., https://<YourUsername>.gitlab.io/<your-hugo-site>/ ) and not a custom domain.

Yours: config.toml · master · ca_water_data / ca_water_data_blog · GitLab

If you inspect the rendered page, the link to Posts points to <a href="/posts/">Posts</a>

In your case, https://ca_water_data.gitlab.io/posts/ does not exist, but https://ca_water_data.gitlab.io/ca_water_data_blog/posts/ does, if you navigate there manually.

@pointyfar Okay excellent. I can do that. So I should set the baseURL key to https://ca_water_data.gitlab.io/ca_water_data_blog. I can give that a shot. Haha, you found the missing posts, that is great. I did not notice that when I clicked on posts, it was going to just https://ca_water_data.gitlab.io/posts instead of the full https://ca_water_data.gitlab.io/ca_water_data_blog/posts. Let me give it a shot and see what happens. Thanks so much for showing me where to look.

@pointyfar yep, this was the issue. I can see the posts coming up correctly now. Thanks again for your help with this. I really appreciate it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.