Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ googleAnalytics = "" # DEPRECATED! Use .Services.googleAnalytics.ID
mathjax = true # Enable MathJax
mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js" # Specify MathJax path
mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config
googleFontsLink = "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" # Load Google Fonts
googleFontsLinks = [
"https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" # Load Google Fonts
]
customCSS = ["css/custom.css"] # Include custom CSS files
customJS = ["js/custom.js"] # Include custom JS files

Expand Down
4 changes: 2 additions & 2 deletions exampleSite/content/docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,11 @@ Our href font link:
https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap
```

1. Set `googleFontsLink` site's config param value to your href font link. For example:
1. Set `googleFontsLinks` site's config param value to your href font links. For example:

```toml
[Params]
googleFontsLink = "https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap"
googleFontsLinks = ["https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,700;1,400&display=swap"]
```

1. Override default font-family set(s):
Expand Down
12 changes: 8 additions & 4 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@
{{ template "_internal/twitter_cards.html" . }}
{{- end }}

{{- $googleFontsLink := .Site.Params.googleFontsLink | default "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" }}
{{- if hasPrefix $googleFontsLink "https://fonts.googleapis.com/" }}
{{- $googleFontsLinks := .Site.Params.googleFontsLinks | default (slice "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700") }}
{{- if $googleFontsLinks }}
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//fonts.gstatic.com">
<link rel="stylesheet" {{ printf `href="%s"` $googleFontsLink | safeHTMLAttr }}>
{{- range $googleFontsLinks }}
{{- if hasPrefix . "https://fonts.googleapis.com/" }}
<link rel="stylesheet" {{ printf `href="%s"` . | safeHTMLAttr }}>
{{- end }}
{{- end }}
{{- end }}

{{ $style := resources.Get "css/style.css" | resources.ExecuteAsTemplate "css/style.css" . -}}
Expand Down Expand Up @@ -68,4 +72,4 @@
{{- end }}
{{- partial "mathjax.html" . -}}
</body>
</html>
</html>
Loading