From 8d51b8ba619af4504ad40386f6b452e50ec8a39b Mon Sep 17 00:00:00 2001
From: Christian Bromann <github@christian-bromann.com>
Date: Wed, 29 Sep 2021 11:19:47 +0000
Subject: [PATCH] feat: Added support for Google Fonts (#255)
---
layouts/partials/head.html | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 042003d..f4c9ef6 100644
--- a/layouts/partials/head.html
+++ b/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 -->
--
Gitblit v1.10.0