Comments (5)
Hey,
I managed to change the font on a child version of the theme. Caution: I'm very new with Hugo so it's probably not the best way, but it works :) In this example, our new font-family is Fengardoneue.
- Drop the folder containing your font in
/static/fonts/
- Copy
node_modules/@hyas/doks/assets/scss/common/_variables.scss
toassets/scss/common/_variables.scss
- Rename
assets/scss/common/_variables.scss
toassets/scss/common/_variablesCustom.scss
- Copy
node_modules/@hyas/doks/assets/scss/app.scss
toassets/scss/app.scss
- In
assets/scss/app.scss
, replace@import "common/variables";
by@import "common/variablesCustom";
- Create a
custom.scss
inassets/scss/common/
- Insert your font font-face script into custom.scss :
/* fengardoneue - latin */
@font-face {
font-family: "Fengardoneue";
font-style: normal;
font-weight: 400;
font-display: swap;
src:
local("Fengardoneue"),
url("fonts/Fengardoneue/fengardoneue_regular.woff2") format("woff2"),
url("fonts/Fengardoneue/fengardoneue_regular.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
/* fengardoneue black - latin */
@font-face {
font-family: "Fengardoneue";
font-style: normal;
font-weight: 800;
font-display: swap;
src:
local("Fengardoneue_black"),
url("fonts/Fengardoneue/fengardoneue_black.woff2") format("woff2"),
url("fonts/Fengardoneue/fengardoneue_black.woff") format("woff"); /* Chrome 6+, Firefox 3.6+, IE 9+, Safari 5.1+ */
}
- Finally, in
assets/scss/common/_variablesCustom.scss
replace$font-family-sans-serif: "Jost", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
by$font-family-sans-serif: "Fengardoneue", "Jost", -apple-system, blinkmacsystemfont, "Segoe UI", roboto, "Helvetica Neue", arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
— (I just added it to let Jost as a backup).
Et voilà!
Hope it helps ^^
from getdoks.org.
I have successfully changed the font following @ImaCrea's instructions. Thank you!
But I encountered a problem as leoplct at the beginning. When editing the file _custom.scss
in step 7, I used a tff
font, but it kept using the original one. After I changed the tff
file to woff/woff2
, it worked immediately.
I'm entirely new to web development, so I don't know why. Maybe the problem raised by leoplct is also caused by this because I noticed that the _fonts.scss
file provided also uses tff
fonts.
from getdoks.org.
Any reason for using ttf
?
Although regular OpenType fonts (TTF and OTF files) can be used as web fonts, such usage is not recommended as it usually contravenes license agreements—and the files are significantly larger.
Source: Web font
I recommend converting ttf
to woff2
with a tool like e.g. TTF to WOFF2 Converter
from getdoks.org.
No special reason, just because the font file I got is ttf
, and I have no experience with using fonts.
By the way, I love the design of doks, thanks for your work, and it would be better if there is documentation on how to change the font.
from getdoks.org.
Thanks + noted
from getdoks.org.
Related Issues (20)
- Fix DocSearch settings HOT 1
- Inform on new release — Doks v0.3 / v0.3.5
- Send out questionnaire HOT 1
- Add WebP + AVIF support HOT 1
- How to update Doks itself? HOT 1
- Improve docs for customizing scss HOT 6
- Add Google Analytics setup guide HOT 1
- Add DocSearch setup guide HOT 1
- Single navbar
- Update "Add a documentation page"
- Update setting production URL
- Archetypes — identifier needs to be unique
- Broken URL for frontmatter HOT 1
- Update Doks documentation HOT 4
- Getting Started Guide missing info for running on Windows HOT 4
- Bootstrap table shortcode
- Add links to other docs
- Add website to showcase HOT 1
- npm install is very slow HOT 14
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 getdoks.org.