Skip to content

Commit

Permalink
Add: Fallback font for symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
alphapapa committed Sep 27, 2023
1 parent 6bddff1 commit 1861df4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion assets/theme-css/vars.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* prettier-ignore */
:root {
--fontFamily: {{ .Site.Params.font.name }};
--fontFamily: "{{ .Site.Params.font.name }}", "{{ .Site.Params.font.fallbackName }}";

--colorPrimaryDark: rgb(1, 50, 67);
--colorPrimary: rgb(77, 119, 207);
Expand Down
1 change: 1 addition & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ params:
navColor: blue
font:
name: "Lato"
fallbackName: "Noto Sans Symbols 2"
sizes: [400, 900]
plausible:
dataDomain: null
Expand Down
8 changes: 8 additions & 0 deletions layouts/partials/css.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@

<link rel="icon" href="{{ "images/favicon.ico" | relURL }}" />
<link rel="stylesheet" href="{{ $fontUrl }}">

<!-- Fallback font for symbols (such as "🛈"). -->
{{- $fallbackFontName := .Site.Params.font.fallbackName | default "Noto Sans Symbols 2" -}}
{{- $fallbackFontFace := replace $fallbackFontName " " "+" -}}
{{- $fallbackFontSizes := delimit (.Site.Params.font.sizes | default (slice 300 400 600 700)) "," -}}
{{- $fallbackFontUrl := printf "https://fonts.googleapis.com/css?family=%s:%s" $fallbackFontFace $fallbackFontSizes -}}
<link rel="stylesheet" href="{{ $fallbackFontUrl }}">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">

<!-- SASS --- currently only for fresh -->
Expand Down

0 comments on commit 1861df4

Please sign in to comment.