From 46eefcebbc77318e6f25aa9db915ce4c3ba5b909 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Sun, 10 Jul 2022 15:03:14 +0800 Subject: [PATCH] :zap: Perf: optimize keywords meta generation code --- layouts/partials/head/meta.html | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/layouts/partials/head/meta.html b/layouts/partials/head/meta.html index 32356603..af2f6183 100644 --- a/layouts/partials/head/meta.html +++ b/layouts/partials/head/meta.html @@ -3,7 +3,18 @@ - + +{{- $keywords := .Keywords -}} +{{- if not $keywords -}} + {{- if .IsPage | and .Params.tags -}} + {{- $keywords = .Params.tags -}} + {{- else -}} + {{- $keywords = .Site.Params.keywords -}} + {{- end -}} +{{- end -}} +{{- with $keywords -}} + +{{- end -}} {{- template "_internal/schema.html" . -}} {{- template "_internal/opengraph.html" . -}}