Publishing Hugo


#1

‪In Hugo, how come when I use the command “hugo” to make the public folder that there’s no formatting and themeing done - just plain text? When I use “hugo server” then it looks fine. Thoughts?‬


#2

Difficult to say without seeing the source of your project.

See: Requesting Help


#3

Any help you can offer would be greatly appreciated:

https://drive.google.com/open?id=1ZXCpM8o4c0ZV42kZgP8n2uGu8-GAaJgy


#4

I will look into it later as I have to go out.


#5

Hi,

The theme you are using seems to be referencing a bootstrap css file, but I don’t see such a file in your static dirs:

<!-- layouts/partials/head.html -->
<link rel="stylesheet" href="{{ "css/bootstrap.min.css" | absURL }}">
static/
├── css
│   └── hugo-easy-gallery.css
...

#6

I must be doing something wrong. I’m not sure if it’s a theme/code issue.

I’ve tried locally on my machine multiple times with different themes using a fresh install.

Here’s basically what I’m doing :

  1. $ hugo new site X

  2. copy an unzipped theme file to themes

  3. go into the example site and copy the config file to the root of site X

  4. add a post or two (copied from the sample example site)

  5. $ hugo server (everything looks fine when I run it locally)

  6. stop the server

  7. $ hugo (to put the stuff to the public folder)

  8. Go into the public folder and click on the index.html file (then view in web browser and everything looks bad! No themeing…)

Thoughts?


#7

Here’s the published site… https://bershatsky.net/

This is now how it looks when ran locally with hugo server.


#8

Looking at and inspecting the published site (go to site, right click > Inspect > Console), it complains of missing css and js files.

You seem to be using the Vanilla Bootstrap theme in the code you posted above. Looking at the theme source, here, there should in fact be bootstrap.min.css, which your code is lacking at /themes/vanilla-bootstrap-hugo-theme/static/css.


#9

Furthermore to what @pointyfar posted above

In your <head> tag you reference this CSS file: https://bershatsky.net/css/bootstrap.min.css that is 404. Missing both locally and when the project is deployed.

Also in your config.yaml you have a different setting for the domain
i.e. baseURL: https://bershatsky.com

You need to be consistent with the baseURL value. It needs to reflect the domain in whch the project will be deployed otherwise you will get 404 errors.


#10

Also, keep in mind that trying to browse your site from the local file system will give different results vs using a web server (such as hugo server)


#11

It worked!!!

Thanks you everyone for the help! It’s up and running!!! I’m not too keen on the way it looks, but that’s a whole other issue. At least I got it up there and running! Woohoo!


#12

Hello
You could share how you solved it. Did you need to indicate the url on baseURL?
byeee