From 2a4af57dfc26356c60a8d18c9ed343aa01af4d23 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 8 May 2020 01:00:56 +0800 Subject: feat: shortcodes support bilibili --- layouts/shortcodes/bilibili.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 layouts/shortcodes/bilibili.html diff --git a/layouts/shortcodes/bilibili.html b/layouts/shortcodes/bilibili.html new file mode 100644 index 0000000..17ebdda --- /dev/null +++ b/layouts/shortcodes/bilibili.html @@ -0,0 +1,24 @@ +
+ {{- $bvid := "" -}} + {{if .Get "id"}} + {{$bvid = .Get "id"}} + {{else if .Get 0}} + {{$bvid = .Get 0}} + {{end}} + {{if $bvid}} + + {{else}} +
请填写视频 url 中的视频 id,例如:BV1FV411d7u7
+ {{end}} +
-- cgit v1.2.3 From 1935e8fe3f3d08a79bf2bb07329acc8ec1c46791 Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 8 May 2020 12:26:31 +0800 Subject: docs: add bilibili to README.md --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index e4b98cf..994094a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Features - [Twitter Card](https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary) supporting - Builtin iconfont (3KB) - Display author profile at article bottom +- Support Bilibili shortcodes Preview the exampleSite: @@ -176,6 +177,14 @@ When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ ``` +### Bilibili shortcodes + +```html +{{< bilibili BV1FV411d7u7>}} +OR +{{< bilibili id="BV1FV411d7u7">}} +``` + ### Comments Setup Disqus [shortname](https://help.disqus.com/en/articles/1717111-what-s-a-shortname) in config.toml: -- cgit v1.2.3