Why won't Hugo work with S3?

Hugo renders locally but not in s3 and have no idea why. I’ve read plenty of guides and everyone seems to be able to set it up really easily… am I missing something?

Website: https://marcusburst.website/
Code: https://github.com/marcusburst/website

  1. How are you deploying?

  2. index.md is unnecessary-- unless you have a md output format?

├── layouts
│   ├── _default
│   │   ├── baseof.html
│   │   ├── list.html
│   │   ├── single.html
│   │   └── terms.html
│   ├── index.html
│   ├── index.md

  1. This should be a _index.md
├── content
│   └── index.md
  1. You have a theme but it’s an empty folder?
theme = "cactus"
└── themes
    └── cactus
    ...?
  1. Pushing from github to S3
  2. Thanks
  3. Thanks
  4. Very interesting, I never noticed this. On my local PC the files are populated but seems like they aren’t getting to Git. In the interest of troubleshooting i’ve removed this and changed the config file for now.

I’m starting to think it may be a cloudfront issue?

So s3 wants an index.html specifically in the root of the website, however hugo doesn’t have that. How do people get around that?

Do you mean that the contents of your repo is what you put into your bucket?

In general, deploying your site involves building your site first, i.e. running hugo (not hugo --server) to generate the public folder. Then the contents of the public folder is what gets deployed.

There are different ways to manage this. One is to do exactly the above, running hugo on your local machine then uploading the contents of the public folder manually yourself.

Hugo also has a built-in deploy command for some of the more common deploy options, which includes S3: https://gohugo.io/hosting-and-deployment/hugo-deploy/

This makes so much sense. I had no idea you actually had to run the hugo command and generate the public folder.

My workflow pushes automatically to git, which has a github action to push to the s3 bucket. So if I just push the public folder after running hugo then I should have no issues?

Seems like I have content and working links on the website now. The CSS is borked but I assume that’s a different issue for me to fix.

Looks like changing the config.toml to my website fixed the homepage and that looks good now, but then the links were broken. I turned on uglyurls which seems to have fixed that.

The only thing still broken is some pages it seems. So website/posts, website/tags, website/about etc.

Any ideas why that might be happening?

You have no config.toml in your repo

That hasn’t helped. It’s in the repo when I run the hugo command locally… in any case i’ve put it into the bucket but same issue.

It seems like S3 isn’t appending /index.html after /posts /categories etc.

That’s because of uglyURLS. /posts/ is /posts.html, not /posts/index.html.

Thank you!! I’ve fixed this by changing my config.toml to: url = "/posts/index.html"