While I write plenty of documentation and build/administer servers (of the unix variety) for a living, I am not a web developer. Creating content is one thing, but making it pretty is quite another. I was thrilled when I found hugo - I am a minimalist of sorts, always looking for the simpler/smaller/faster ways to do things, and the idea of a static site based on pure text content and stitched together with a single command very much appeals to me.
After building hugo from source in a chroot on my chromebook, I was able to create a new site and a couple of posts. After looking through a few of the available themes i settled on the bootstrap theme because i liked the idea of seeing word counts and estimated time to read, as well as the tag/category stuff. So I copied the example config.toml into place, disabled disqus, renamed the site and author, and generated the site. what i see with ‘hugo serve’ looks great - but when copying ./public to the webhost, theme elements appear to be missing. Before digging into differences in html and css, which I am not looking forward to, I wanted to ask:
- is there a known issue with the bootstrap theme
- what are possible reasons for pages being different when published versus ‘hugo serve’ ?
I’m certain I’m not the first to bump into this, and am hoping not to have to retrace the steps of others …
Remember to set
baseURL in config.toml.
I’ve done that. And I have found that, at least with this particular theme, if the baseURL does not end in a slash, links are rendered incorrectly. This may be covered in the documentation and I missed it, but in the end the published version fails to render properly with or without the appended slash in baseURL.
Then that is a bug with that particular theme, and it would be good if you reported it on the theme’s issue tracker.
That’s great to hear (for hugo, at least). For now I’ll move on to another theme. Suggestions for themes with the same features would be welcomed.
There are currently 10 Bootstrap themes listed in the showcase. For future posts, please link to the theme you are talking about.
And please, report this issue to the theme developer, so they can fix it. That is how free software works.
Yes, that is indeed how free software works. Before reporting, however, I want to try to prove (to myself, anyway) that the theme is in fact to blame. I’m not 100% certain that my own configuration is correct. I figure one way to figure that out is to try another similar theme.
I just can’t figure why it seems to work with “hugo serve” and not elsewhere. I had hoped that this was some kind of known behavior related to hugo that I had not yet read about - something simple like the “baseURL” suggestion by bep.
At any rate, I’ll look into the other themes and report back.
Oh, and this is the theme I’ve been working with.
You can post a link to your config. That is a great way to get help here in the forums; otherwise we are making broad suggestions, none specific to your scenario.
I didn’t immediately see anything weird in your
config.toml and I’m honestly not quite sure why it’s not working appropriately when deployed to S3. Maybe there is something else going on?
The theme isn’t making use of relative URLs, so I fixed that and issued a pull request: Use relative URLs. Maybe pull my version for now and see if that magically fixes the problem?
I merged this. Hope this resolves your issue. Please send me a link to a test/demo website it is still a problem.
Sweet, thanks @mmrath! @dehylton I too would like to know if this fixes your problem.