diff options
author | Daniel Saunders <10623666+funkydan2@users.noreply.github.com> | 2020-07-25 07:38:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-25 07:38:32 +0300 |
commit | 4d88c0debf77e0b4d6c85c6613fc6c7a3f1929e4 (patch) | |
tree | fab7e2608f1136e6846e7dd42f88773fd064ba03 | |
parent | 2c7c24f79d5ea7c0fd145b7200af5b4391ba584f (diff) | |
parent | d364c306fc5af4ada866295aa5cd5b07eee222d5 (diff) |
Merge pull request #48 from alfredocambera/add-custom-google-fonts
Allows you to overwrite default included fonts
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | exampleSite/config.toml | 1 | ||||
-rw-r--r-- | layouts/partials/header_includes.html | 7 |
3 files changed, 8 insertions, 2 deletions
@@ -32,7 +32,7 @@ It was originally developed by [b. avianto](https://github.com/avianto/hugo-kier - Utilize normalize.css for consistent styling (Cloudflare CDN). - Use Google Fonts: Ruda (serif) and Roboto Slab (sans-serif). - [Disqus](https://disqus.com) or [Utterances](https://utteranc.es) comments loaded on demand. - +- Supports downloading extra [Google Fonts](https://fonts.google.com/). ## Demo diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 86e9548..2604235 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -36,6 +36,7 @@ pygmentsCodeFences = true #homepageLength = 10 #commentAutoload = true #This mean reader don't need click, disqus comment autoload #mathjax = true #Enable display of mathematics using mathjax (LaTeX syntax) + #google_fonts = ["Staatliches"] # Adds additional google fonts # uncomment to enable the Tags link on the main toolbar # [[menu.main]] diff --git a/layouts/partials/header_includes.html b/layouts/partials/header_includes.html index 3aa5418..c11e0f4 100644 --- a/layouts/partials/header_includes.html +++ b/layouts/partials/header_includes.html @@ -10,7 +10,12 @@ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css" integrity="sha256-l85OmPOjvil/SOvVt3HnSSjzF1TUMyT9eV0c2BzEGzU=" crossorigin="anonymous" /> <link rel="stylesheet" href="{{ "fontawesome/css/all.min.css" | absURL }}" /> - <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab|Ruda" /> + {{ if .Site.Params.google_fonts }} + {{ $url_part := (delimit .Site.Params.google_fonts "|") | safeHTMLAttr }} + <link {{ printf "href=\"//fonts.googleapis.com/css?family=%s\"" $url_part | safeHTMLAttr }} rel="stylesheet"> + {{ else}} + <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto+Slab|Ruda" /> + {{ end }} <link rel="stylesheet" type="text/css" href="{{ "css/styles.css" | relURL}}" /> {{- range .Site.Params.customCSS -}} <link rel='stylesheet' href='{{ . | absURL }}'> |