mirror of https://github.com/lxndrblz/anatole.git

Christian Bromann
29.19.2021 8d51b8ba619af4504ad40386f6b452e50ec8a39b
feat: Added support for Google Fonts (#255)

3 files modified
24 ■■■■■ changed files
README.md 13 ●●●●● patch | view | raw | blame | history
exampleSite/config/_default/params.toml 2 ●●●●● patch | view | raw | blame | history
layouts/partials/head.html 9 ●●●●● patch | view | raw | blame | history
README.md
@@ -28,6 +28,7 @@
- Open Graph support
- MIT License
- Fontawesome 5.15.1 icons
- Google Fonts support
- Custom CSS (optional)
- Custom JavaScript (optional)
- Medium like zoom for images
@@ -368,6 +369,18 @@
Replace the hash with the one Google provided you.
### Google Fonts
You can enable any [Google Font](https://fonts.google.com/) by selecting a font on the Google Font website and adding the `family` parameter of the font url to the `googleFonts` option in `[params]`, e.g.:
```toml
[params]
googleFonts = [
  "Indie+Flower",
  "Roboto:ital,wght@0,100;0,400;0,700;1,400"
]
```
### Beautiful math functions
```toml
exampleSite/config/_default/params.toml
@@ -15,6 +15,8 @@
doNotLoadAnimations = false
# Form Spree Contact Form
#contactFormAction = "https://formspree.io/f/your-form-hash-here"
# Google Fonts
#googleFonts = ["Indie+Flower", "Roboto:ital,wght@0,100;0,400;0,700;1,400"]
# Google Site Verify
#googleSiteVerify = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
singleDateFormat = "2/1/2006"
layouts/partials/head.html
@@ -99,6 +99,15 @@
    />
  {{- end -}}
  {{ if .Site.Params.googleFonts }}
    {{ $baseUrl := "https://fonts.googleapis.com/css2?family=" }}
    {{ $fontParam := delimit .Site.Params.googleFonts "&family=" }}
    {{ $url := printf "%s" "&display=swap" | printf "%s%s" $fontParam | printf "%s%s" $baseUrl | printf "%s" }}
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="{{ $url }}" rel="stylesheet">
  {{- end -}}
  <!-- Favicons -->