From 10efa941f25f0be8affcb8d4a34354a0cfb0f51a Mon Sep 17 00:00:00 2001 From: Sped0n Date: Fri, 3 Nov 2023 10:01:47 +0800 Subject: [PATCH] feat(langCode.html): add a new partial template to check if the current language code matches the site's language code The `langCode.html` partial template is added to the `layouts/partials/function` directory. This template is used to check if the current language code matches the site's language code. It iterates over the language codes and sets a boolean variable `$res` to `true` if there is a match. The template then returns the value of `$res`. This partial template can be used in other templates to conditionally render content based on the language code. --- layouts/partials/function/langCode.html | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 layouts/partials/function/langCode.html diff --git a/layouts/partials/function/langCode.html b/layouts/partials/function/langCode.html new file mode 100644 index 0000000..68e892d --- /dev/null +++ b/layouts/partials/function/langCode.html @@ -0,0 +1,9 @@ +{{- $res := false -}} + +{{- range . -}} + {{- if eq site.LanguageCode . -}} + {{- $res = true -}} + {{- end -}} +{{- end -}} + +{{- return $res -}}