From b44d2a736cadf06b768cc467ef2edfa47d3bd648 Mon Sep 17 00:00:00 2001 From: chenyin <1270224500@qq.com> Date: Mon, 29 Apr 2024 15:23:22 +0800 Subject: [PATCH] added support for police beian for China ISP --- exampleSiteMultilingual/hugo.toml | 1 + layouts/partials/footer.html | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/exampleSiteMultilingual/hugo.toml b/exampleSiteMultilingual/hugo.toml index 26ef82d..29db0d1 100644 --- a/exampleSiteMultilingual/hugo.toml +++ b/exampleSiteMultilingual/hugo.toml @@ -18,6 +18,7 @@ dateFormat = "2006-01-02" paginationSinglePost = true # icp = "京ICP备xxxxx号-1" # for China ICP license +# police = "京公网安备 xxxxxxxx号" # for China police beian colorTheme = "auto" colorThemeSwitcher = true diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index d0e4555..ea511b7 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -20,9 +20,20 @@ {{ end }} -
+
+ {{ $police := .Site.Params.police }} + {{ $info := "info" }} + {{ $pattern := "[0-9]+" }} + {{ $matches := findRE $pattern $police }} + {{ if $matches }} + {{ $firstNumber := index $matches 0 }} + {{ $info = print $firstNumber }} + 备案图标 + {{ .Site.Params.police }} +   + {{ end }} {{ if .Site.Params.icp }} - {{ .Site.Params.icp }} + {{ .Site.Params.icp }} {{ end }}