PippoRJ / hugo-refresh

MIT License
115 stars 79 forks source link

Font awesome icons not loaded #81

Closed magoorden closed 1 month ago

magoorden commented 1 year ago

I have started using this theme, but I noticed that the font awesome icons are not shown, see screenshot below.

Screenshot 2022-09-17 at 16 21 56

I can narrow the problem down to me having a subfolder as a baseURL, i.e. "https://www.example.com/root/". Some of Hugo's problems with subfolders as a root can be resolved by including RelativeURLs: true and CanonifyURLs: true, but this does not solve the missing font awesome issue.

PippoRJ commented 1 year ago

Hey @magoorden mmmmmm I see... does it work if you remove the subfolder as baseURL?

magoorden commented 1 year ago

Yes, it does work when I remove the subfolder. Steps to reproduce:

  1. Follow your steps on https://themes.gohugo.io/themes/hugo-refresh/ to run the example site.
  2. Add a subfolder to the example baseURL.
  3. I cons are no longer working.

But I kind of need that subfolder, because the university provides the domain https://homes.cs.aau.dk/~martijn/ for me.

PippoRJ commented 1 year ago

The includes are done in the css.html page of the theme.

The problem seems to be that with a subfolder in the baseURL then the subfolder is includes in the css files path as well... but the files are not in the that subfolder when you do hugo server -D... If that is indeed the problem then when you upload the content of public folder to your own university folder the problem should solve itself because the path will be correct... Let me know how it goes

PippoRJ commented 1 year ago

I solved another issue when the BaseURL has a subfolder... related to the homepage link in the navbar and in the footer... please pull the repo...

magoorden commented 1 year ago

I have run your example site (where I changed the baseURL to https://homes.cs.aau.dk/~martijn/) with hugo -D and uploaded them to https://homes.cs.aau.dk/~martijn/. As you can see, Hugo can't still figure this subfolder thing out properly...

magoorden commented 1 year ago

I solved another issue when the BaseURL has a subfolder... related to the homepage link in the navbar and in the footer... please pull the repo...

I noticed the navigation to the home page could also be resolved by adding

RelativeURLs: true
CanonifyURLs: true

to the config.yaml file.

Nonetheless, I will pull your recent changes.

PippoRJ commented 1 year ago

the problem seems to be that the file all.min.css is loading urls paths from the root of the domain (this path /webfonts/).... and since your site is in a subfolder then is not able to load the resources correctly..

magoorden commented 1 year ago

I tried upgrading fontawesome to version 6 and that solved the issue with the path to /webfonts/. In version 6 the urls in all.min.css are slightly different formulated. This fixed the issue.

I created a pull request with the changes I made to fix the issue.

PippoRJ commented 1 year ago

Thanks that's awesome..! I did modified the all.min.css because I wanted to load local resources and not remote ones.. so if that is going to load remote resources I will have to modify it again.. To completely solve the issue (i.e.: to be able to load local resources from correct path) you need to process that .css file in the same way I am processing the .svg files to follow the main colour scheme... not sure if you notice but the .svg files change colour when you change the main colour... that will be an amazing pull request..!

magoorden commented 1 year ago

The all.min.css file only has url fields referring to the local /webfonts/ folder. So I think that it will not load remote resources. I will check later whether the svg images change color (yes, I noticed it, as I changed the color for my website).

magoorden commented 1 year ago

To completely solve the issue (i.e.: to be able to load local resources from correct path) you need to process that .css file in the same way I am processing the .svg files to follow the main colour scheme... not sure if you notice but the .svg files change colour when you change the main colour... that will be an amazing pull request..!

I checked the color change using your example website. I changed the mainColour attribute in config.yaml to some random color (0b9444 to be precise), and, for example, the SVG logo in the footer nicely changes color as well without changing anything else in the code.

Screenshot 2022-09-23 at 14 05 55

PippoRJ commented 1 month ago

Font awesome updated to latest release, it should be fixed