From 59c7d4567380d1a9c80e96eb958fdbdd512ce006 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Sun, 3 Nov 2024 20:08:36 +0300 Subject: новая жизнь блога MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/shortcodes/bilibili.html | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/bilibili.html (limited to 'themes/hugo-theme-stack/layouts/shortcodes/bilibili.html') diff --git a/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html b/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html new file mode 100644 index 0000000..cb72e43 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html @@ -0,0 +1,23 @@ +{{ $vid := (.Get 0) }} +{{ $videopage := default 1 (.Get 1) }} +{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }} +{{ $videoQuery := "" }} + +{{ if strings.HasPrefix (lower $vid) "av" }} + {{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }} +{{ else if strings.HasPrefix (lower $vid) "bv" }} + {{ $videoQuery = querify "bvid" $vid }} +{{ else }} +

Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确

+

当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}

+{{ end }} + +
+ +
-- cgit v1.2.3