diff options
author | 6cdh <cd6cdh@gmail.com> | 2021-02-27 17:43:29 +0300 |
---|---|---|
committer | 6cdh <cd6cdh@gmail.com> | 2021-02-27 18:32:21 +0300 |
commit | 403dab7c53a8cd7fb0ce1a5d71c9165452592030 (patch) | |
tree | 8e70927ab693ec4b77083207f6f1e7804e4c46e6 | |
parent | 8cbbd911190856c4e6aa8a1d01fac3a4559d7266 (diff) |
Added google fonts support
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/gfonts.html | 10 | ||||
-rw-r--r-- | layouts/partials/header.html | 3 |
4 files changed, 15 insertions, 0 deletions
@@ -45,6 +45,7 @@ authorEmail = "ribice@gmail.com" # Author email [params.assets] customCSS = ["css/custom.css"] +googleFonts = [] [params.info] adsense = "" # Adsense ID (ID only, without ca-pub-) diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 2386433..ca23e6b 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -15,6 +15,7 @@ authorEmail = "ribice@gmail.com" # Author email [params.assets] customCSS = ["css/custom.css"] +googleFonts = [] [params.info] adsense = "" # Adsense ID (ID only, without ca-pub-) diff --git a/layouts/partials/gfonts.html b/layouts/partials/gfonts.html new file mode 100644 index 0000000..c86e33f --- /dev/null +++ b/layouts/partials/gfonts.html @@ -0,0 +1,10 @@ +<link rel="preconnect" href="https://fonts.gstatic.com" /> +<link + href="https://fonts.googleapis.com/css2?family= +{{- range $index, $font := .Site.Params.Assets.googleFonts -}} + {{- if $index -}}&family={{- end -}} + {{ $font }} +{{- end -}} +&display=swap" + rel="stylesheet" +/> diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 20e77fc..5d6277b 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -21,6 +21,9 @@ {{ if or .Site.Params.Features.mathjax .Params.mathjax .Site.Params.Features.katex .Params.katex }} {{- partial "math" . -}} {{ end }} +{{ if .Site.Params.Assets.googleFonts }} +{{- partial "gfonts" . -}} +{{ end }} <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> |