WojciechF
WojciechF

Reputation: 370

how to use Hugo with github pages to automatically update content

I am using Hugo to deploy a static page to github pages

I have a git repo in the /public folder but the contents of the /static folder are not a part of the repository. Therfore they are not uploaded to the username.github.io page.

the /static folder contains images and css files. This is why my page does not look good after pushing to github.

My workaround is that each time I manually copy the /static folder into the /public folder after I build the site.

I think there should be a better solution and I am probably missing something in the config.toml file of the hugo workflow.

I am following the instructions from this site

Any ideas how to automatically include /static files into the repository?

Upvotes: 1

Views: 928

Answers (1)

Jack Taylor
Jack Taylor

Reputation: 6207

Hugo copies all the files in the static/ directory into the public/ directory when your site is rendered. For example, if you have a static/ folder that looks like this:

.
├── css
│   └── main.css
└── img
    ├── favicon.png
    └── avatar.png

Then when you build your site, the public/ folder will look like this:

.
├── css
│   ├── main.css
│   └── <theme css files>
├── img
│     ├── favicon.png
│     ├── avatar.png
│     └── <theme images>
<more content folders> 

So the files in your static folder are probably being included already. The problem is likely to be that your theme is looking for your static files in the wrong place. Take a look at your theme documentation and see if it says anything about static assets.

Upvotes: 4

Related Questions