The above works, when I inspect the website, it’s trying to load the font but it gives a 404 error because it can’t find it.
I’ve tried including it in:
themes/theme/static/fonts/Mohave-Regular.woff2
themes/theme/assets/fonts/Mohave-Regular.woff2
themes/theme/data/fonts/Mohave-Regular.woff2
But none of them work.
It does work if I include it in the site’s root folder – so it’s not a problem with the font, my browser, the path in the scss – but I don’t want that.
I want it as part of the theme.
As I understand, the theme/static folder merges with the site’s root static folder, right? So if there’s no fonts folder in the root, it shouldn’t be overriding the theme’s version, right? So why isn’t it including it?
I had a look through it, and while your answer works when I include the fonts in the site’s root static folder, it doesn’t seem to apply for the theme itself. I mentioned this in the original question.
Maybe this is a Hugo limitation? I can’t store fonts within the theme?
Can you think of a workaround? Or am I missing something?
As always, it’s a lot easier to work through these questions when we have all the details. Can you share a link to the public repository for your project?
Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.
If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.
So after studying tons of other themes (their scss, fonts, heads, etc.) that were doing EXACTLY the same thing that I was doing… I realized what I wasn’t doing.
When you add local fonts to a LIVE rendered site, you actually need to restart it.
I guess they get loaded into the resources, and then don’t get reloaded.
Leaving this here in case anyone else runs into the same issue.