I’m really enjoying Hugo so far! My setup → uploaded ‘public folder’ files to S3 bucket → cloudfront distribution with custom domain name.(Using Route 53 for DNS)
The issue I can’t seem to fix is that when I go to the domain the CSS and fonts are not loading. When I try to visit a post I can see that there is duplicate url. In this case: https://example.com/posts/how_tobackup/
What I tried so far. I read the [Requesting Help] post, and found out about how import the baseurl is.
Check MIME type in S3 bucket for right type: not plain text but css or js
Tried multiple baseurl variations: baseURL = “https://example.com” and “/” and “.”
Site is working correctly with hugo server
I’m really pulling my hair out because if this issue. Thank you very much for thinking with me
You are right. I changed the baseurl to https://thomasbrinkman.nl/ note the / which fixed the issue. After I changed to S3 bucket properties → enable static site hosting → true. The .css is also rendering. The site seems to be working only linking to other pages and posts seems to be broken. I’m pretty sure this is a AWS S3 & Cloudfront issue. My apologies for creating the post. I will try to post a update when I found the answer.
I have found a solution. The site is operating perfectly now. The solution is creating a lamba function that works at the cloudfront CDN. It fixes the redirecting to example.com/page-namepost-/index.html. I will remove the parts that will link the blog domain.