Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local fonts #200

Open
sschoenwetter opened this issue Sep 23, 2024 · 1 comment
Open

Local fonts #200

sschoenwetter opened this issue Sep 23, 2024 · 1 comment

Comments

@sschoenwetter
Copy link

Hello,

Thank you for this awesome Hugo theme! In my attempt to build a website that is as GDPR-compliant as possible, I would like to avoid using fonts sourced from fonts.googleapis.com or fonts.gstatic.com when loading the website. Instead, I would prefer to store and use local fonts.

While I found the pull request from Google in the public index.html, I haven't figured out where to change this earlier in the process.

Is it possible to modify this within the theme? If so, could you outline where I need to store the fonts and how to alter the theme so that it uses these local fonts?

Your help is greatly appreciated!

Best Wishes

@SithuAung1988
Copy link

Hi @sschoenwetter ,
I don't know why you wish to remove fonts from fonts.googleapis.com or fonts.gstatic.com, but I'm sure you have your reason to do so.
But what I did was, I put my local fonts under static directory (e.g. ../static/fonts/). And then edit font.css under static/css.
I kept google font (i.e., Robot in my case) as a fall-back.
Here is my modified font.css.

@font-face {
    font-family: "Myanmar3";
    src: url('../mmfonts/mm3sh.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Default font for body */
body {
    font-family: "Myanmar3", serif !important;
}

/* secondary font */
.secondary-font, #secondary-font {
    font-family: "Myanmar3", serif ;
}

/* primary font */
.primary-font, #primary-font {
    font-family: "Myanmar3", serif ;
}

/* Default font */
.default-font, #default-font {
    font-family: "Roboto", sans-serif;
}

Hope this help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants