Hugo Site works beautifully in my local server but is broken when publishing to Github

I’m new to Hugo. I’m just trying to create a website for my portfolio and can’t seem to get it down. I followed the Hugo Quickstart guide to make a website in Ananke and spent hours learning how to do it. However no matter what I do the website is fundamentally broken whenever I publish it to Github Pages. I’ve tried so many different things, even deleted the whole thing and recreated it again in a new, cleaner directory. Tried using docs instead of public, changed the URL to match, etc. None of it works. I’m at a loss here. Not sure what code to post but here’s the repo. I don’t know what to do, please help.

this is what it looks like when published on GitHub pages.

Your repo contains the published site, not your source code.

apologies, what files would be required then?

the markdown files?

The whole project. Something like:

my-project-directory/
├── archetypes/
│   └── default.md
├── assets/
├── content/
│   ├── posts/
│   │   └── post-1.md
│   └── _index.md
├── layouts/
│   ├── _default/
│   │   ├── baseof.html
│   │   ├── home.html
│   │   ├── list.html
│   │   └── single.html
│   ├── partials/
│   └── shortcodes/
├── static/
│   └── favicon.ico
├── LICENSE
├── README.md
└── hugo.toml

But don’t include the top level directory. Example:
https://github.com/jmooring/hugo-testing/tree/scaffold

it wouldn’t let me upload the themes directory as it has over 100 files and it wouldn’t take it. however, all I have in there is ananke that I got from following the Quickstart guide.

No.

It seems like you’re trying to upload files instead of using the standard Git worklfow (local repository, commit, push to remote repository).

The current content of your repository is insufficient.

im gonna be honest I have no idea how to do that. I tried to follow the guide using actions and workflows but I can’t even do that because the .yaml file breaks despite me just copying the code from the official website

if I somehow managed to get that to work would the site publish correctly, or is my code just broken?

I would have no idea without seeing your project. Which is kind of where we started this discussion.

I genuinely don’t know, this is me adding all the files in the directory for the site besides themes and public

You need to learn the Git workflow, using the command line. If you don’t want to that, you should probably use something other than Hugo.

1 Like

It’s probably easier to ditch Github pages in favor of Netlify.

  • Create Netlify free account > install Netlify cli on your mac > from the same folder that has hugo.toml you run netlify deploy for first time

  • when it asks you what directory to publish, write public

  • every time you make changes/create new content you run netlify deploy --prod
    its so fast and you also get free certificate and all the nice stuff that come with netlify.

  • To chain commands I use hugo --gc --minify && netlify deploy --prod

  • Shout out to @jmooring he is the most dedicated open source dev/supporter out there!