The theme developer is the one who really determines if you can change the fonts used in the theme.
In the case of Ananke theme, there looks to be a file src/css/_styles.css that you can place custom CSS in, then run a command to generate a new CSS file. You can add the CSS you want to specify different fonts for your site from there.
That other question may not have been answered as it isnāt a Hugo-specific issue. Fonts are added via CSS, and that can be modified as an override or by modifying the theme. If you have questions about that, please read the theming documentation.
I use this technique in my basis template for all projects and it works like a charm. Just enter the name of the google font in config.toml and youāre all set.
Iāll add something about this to the readme too (done). If you have specific questions about the theme, feel free to hit me up on the repo. Iām usually here in the forums, but if you drop an issue on the repo Iām sure to get it.
Thanks to everyone for your informative replies: you are a very friendly and helpful community.
I am slowly beginning to realize that the attributes of themes vary with the different authors, although within a given overall structure. I also realize that themes vary with the purpose of the website and that choosing something aligned to my purpose means that customization can be reduced.
I will follow the Google Fonts method @budparr and @Leo_Merkel have outlined and see how I go.
Thank you @Leo_Merkel. I found your idea very appealing as it is generic and works across themes.
However, I found a difficulty with the suggestion from the link given because the + in the Google font name for multi-barrelled font names was being translated as %2b when the partial was rendered. This caused a 404 error and the chosen fonts were not being rendered.
I have since refined my solution to incorporate ideas I have encountered on this forum:
(a) CSS styling via variables should preferably not reside in a Hugo partial template, but rather should be handled with a CSS pre-processor. This allows fine-grained font control via add-on stylesheets.
(b) The loading of the Google Fonts may still be accomplished via a Hugo partial template.
Here is what I ended up doing:
config.toml has a variable called googlefonts set so:
This is admittedly a little more cumbersome to maintain when a font change is desired, but is, I believe, in keeping with a cleaner layout as envisaged by the designers.
I have tried it both with https://fonts... and simply as //fonts...config.toml. It seems to work in both cases.
I have tried your fonts in my CSS style sheet and they work. Please see attached image from a test blog to confirm that these are the fonts you seek.
.
Might I suggest that you use double quotes in your CSS file for the font names because that is how I have it in my custom_style.css, e.g., font-family: "Itim", cursive;
I have been away from Hugo and my work on my website for some time now and am aware that many changes have happened in the interim. My version of Hugo is v0.37 in case that helps.
Hi. I came across this post searching for the same thing. I wound up putting together something for a theme Iām working on - combining fonts, config file, partial and SCSS. Hereās the Gist link if it helps anyone. Or if someone sees a way to improve it, let me know.