Unable to get Hugo website running on Github pages

Hi! I am trying to correctly visualize my portfolio on Github pages after deploy with no success and I am running out of ideas for what the problem might be.

Problem:
The live page either shows " This site is open source. [Improve this page]" if my index.html is inside of “layouts” folder (as it is originally in the theme) or it shows the raw index.html file - if I place index.html in the root.

Facts:

  • I am able to run the website without any problem locally.
  • I have followed the suggestions of having “/” as baseURL.
  • I have tried placing the index.html file in the root directory.
  • Inspecting the index page, I get no errors on the console whatsoever when index.html is placed in the root and shows live (as raw html).
  • I get no deployment errors (I follow the builds in Github’s deployment log).

Although I am a software engineer, I am new to Hugo and I have no idea what I can do more, any help would be much appreciated!
My repository is:

I am currently using “UILite” Hugo’s theme:

Can anyone give me some hints, please? Thank you!

Where does everyone see the suggestion about setting baseURL to “/”?! It’s a bad advice. The baseURL should be set to the actual base url of the site and nothing else.

In your case “https://anaritagomes.github.io/”.

I have tried that as well, as first, logical, url. Same results :frowning:

For GitHub pages you need to add GitHub action that build your site and creates a public folder with the actual site. (This can be done manually by building locally and with some git fu push the content of the public dir to a gh-pages branch. But actions is a mush better way).

This is what I use on a number of sites and it works really well.

name: github pages

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
        with:
          submodules: true  # Fetch Hugo themes (true OR recursive)
          fetch-depth: 0    # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: '0.81.0'
          extended: true

      - name: Build
        run: hugo

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public

This action will rebuild you site and deploy it on each new push.

You site also seems to lack a “content” folder, no content → nothing for Hugo to build.

You have a lonely “_index.html” in the root. The content of it looks like a theme but the name with a underscore first suggest it’s content. It’s is in the wrong place in any case.

The “_index” was just renamed in one of my attempts in order to not have effect. The exampleSite indeed has a content folder. I wonder how it works locally with the same structure. I will work around setting up a proper content folder, then. Thank you.

Solved. The problem was not the structure, but the fact that I completely decided to ignore the step of “hugo” command and creating the public directory, and this is the one which goes into Github.

Glad you got it working!