Comments (4)
here is a simple guideline for you. I am using sampoty
font as an example
- store your fonts in the root
static
folder, you need to create this folder. store fonts like./static/sampoty.woff
.
then link the font in custom.scss
@font-face {
font-family: "sampotyregular";
src:
url("../sampoty.woff2") format("woff2"),
url("../sampoty.woff") format("woff");
font-weight: normal;
font-style: normal;
font-display: swap;
}
- If you want to use the custom font as Primary font. then use the font name in
themes.json
file
"fonts": {
"font_family": {
"primary": "sampotyregular",
"primary_type": "sans-serif",
"secondary": "Signika:wght@500;700",
"secondary_type": "sans-serif"
},
"font_size": {
"base": "16",
"scale": "1.250"
}
}
- customize the google font link in
style.html
file. (I removed primary_font link from here)
googleFont.href = "https://fonts.googleapis.com/css2?{{with $sf}}family={{. | safeURL}}{{end}}&display=swap";
and you have successfully setup your custom font, along with google font.
from hugoplate.
Hey @alexgutjahr, thanks for your interest. Custom font needs to link in the CSS file. custom.scss
could be a good way to link your fonts.
from hugoplate.
Thanks for the swift reply @tfsomrat, appreciate it! Also wanna say that your template is the best I've seen over the years, thanks for building it.
About the custom.scss
I can load the font-face in there, how would I then reference the local woff2
file, or more specifically, where do you suggest the files should be stored so they are accessible to the stylesheets? I went with assets/fonts
but was not able to reference the files successfully, i.e. when the page is built the fonts are not found.
Secondly, assuming that I can successfully load the font-face, How do I override just the secondary font? I assume theme.toml
expects a Google font and will not work with custom fonts, will it? If not, where/how can I override just the secondary font? Thanks!
from hugoplate.
Works perfect, thank you!
from hugoplate.
Related Issues (20)
- 404 Defaults to English in Multilingual Site HOT 5
- Please change the default baseURL HOT 5
- npm run build breaks the website HOT 2
- Please change the default baseURL HOT 2
- Site deployed on GitHub pages loses some formatting HOT 1
- Permission to zeon-studio/hugoplate.git denied
- Reload the searchindex.json file twice. HOT 3
- Hero image source HOT 2
- Your file couldn't be accessed HOT 2
- Page widths on mobile displays HOT 6
- CSS is broken when running in Gitpod HOT 3
- when running in provided devcontainer npm run dev errors out HOT 8
- Add basic js testing [enhancement] HOT 1
- CSS broken in .devcontainer example site even after changing baseurl HOT 4
- Error postCSS HOT 4
- :resourceDir not read/write in linux devcontainer running on windows machines
- Light/Dark button flickers when a menu item is clicked
- Navigation ignores external URLs. HOT 1
- unsupported redirect to value "/en/404.html"
- how do I add a security header?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugoplate.