gethugothemes / academia-hugo

Academia is a Hugo resume theme. You can showcase your academic resume, publications and talks using this theme.
https://gethugothemes.com/products/academia/?utm_source=academia_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
203 stars 181 forks source link

Hugo Server works but Hugo (build) has no css or js #14

Closed rebelwarrior closed 4 years ago

rebelwarrior commented 4 years ago

When I use hugo server the site looks fine when I use hugo to build the site on public, the css and js don't load and the site looks like a skeleton. Tried using a baseUrl of "/" as recommended. Same result.

tfsomrat commented 4 years ago

hey there, it doesn't work like that. When you generate hugo you need to specify the baseURL that you want to publish. then after generate the public folder, you need to upload the file there. then it will work.

rebelwarrior commented 4 years ago

Figured out what was going on.

This blog explains it:

https://alison.rbind.io/post/2019-03-04-hugo-troubleshooting/

Sent from my mobile

On Aug 20, 2020, at 12:58 AM, Evan notifications@github.com wrote:  hey there, it doesn't work like that. When you generate hugo you need to specify the baseURL that you want to publish. then after generate the public folder, you need to upload the file there. then it will work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

rebelwarrior commented 4 years ago

Basically what happens is that if the baseURL is set to "/" then the css, js and image (img) files look for files with a double "//" in them. This fails and the site looks undressed. To solve this I re-wrote the calls for css, js and img files on the outputted index.html file in site to remove the preceding "/". So "/img/icon.png" would be "img/icon.png".

This fixes the problem.

When you go to output for deployment rather than testing locally set the baseUrl correctly to the website's site.