GitHub Pages without Peaceiris possible? (Old-style /docs dir vs Hugo /publish)

So I have the GitHub Actions working finally after using the Peaceiris Deploy section (I was trying to avoid having to generate a GH token, which is automatically done).

Looking back, I’m trying to understand what the Peaceiris section is doing… I copied the /publish directory over to /docs, canceled the GH Action workflow by renaming the main.yaml, and checked the deployment. However, the webpage has many broken pieces.

The challenging part is that, I could troublshoot that locally if the index.html from the /docs folder would render correctly without the hugo server. So I’m trying to understand what how the GH page has been rendered by the Actions, and the Peaceiris section is the only part that is different.

I noticed on the local rendered page /docs/index.html it was looking for icon images at /svg/blah.jpg. I changed those to relative “./svg/*” path, and they showed up. Peaceiris must be assigning the root dir.

Basically, I want to know how to use the /public folder generated by Hugo directly. And/or use it for GitHub Pages without Actions… is this possible? Thanks

FWIW, I have a GHA that doesn’t use the Peaceiris action:

@bwintx thanks for the example. I saw it uses: cloudflare/pages-action@1, instead of Peaceiris. I thought it still is using some unknown code to render properly. So I searched on how to force the index.html and found these:

https: //discourse.gohugo.io/t/open-built-website-from-local-folder-without-running-a-server/34193
https: //discourse.gohugo.io/t/site-looks-fine-on-localhost-and-github-pages-but-not-when-rendering-to-public/35825/2

The second one said to put these lines in the config.yaml/toml, and it worked!

baseURL: /
relativeUrls: true
uglyurls: true

Which is nice because I suspected it was a relative path issue… wasnt finding the .js files. Somehow both Deploy solutions must be setting these paths in the background.

So now I can use either the Github Actions deploy, or just build locally and git push the publishDir, and organize my directories accordingly. Either way, I’m happy to be able to troubleshoot code locally with just the index.html and know there isnt any other fancy magic working.

Of course, I would have to set them back to use GH Actions again. But I like that I know how to use Hugo without code that I dont understand.

1 Like

Yeah, I don’t know how to publish to any of the usual hosts (Netlify, Vercel, or CFP) without the respective GHA for each. Anyway, glad you found your solution.

Well, any static site host should be able to take the folder with the index.html and render it properly. That’s what was bugging me. I didnt want to stray from the conventional way too far with Hugo. Turns out it just needs to point to the correct place for files. Thx

btw, on GH Pages, you would just set the " Your GitHub Pages site is currently being built from the /docs folder" under Settings to /docs… and either copy/rename the public folder, or add the publishDir: docs, and possibly symlink it. (have to usually “reverse” the symlink because git push doenst work on symlinked dirs.)

@bwintx oh, btw2, this means you dont have to either pay for GH Actions to use a private repo, or use a public repo if the site is a crappy start and you dont want potential employers to see your shoddy web skills ; )

1 Like

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