Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cntrump/hugo-notepadium.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--layouts/shortcodes/bilibili.html24
2 files changed, 33 insertions, 0 deletions
diff --git a/README.md b/README.md
index 031904d..12efffd 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:
@@ -183,6 +184,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:
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 @@
+<div class="video_wrapper" style="position: relative; padding-bottom: 75%;">
+ {{- $bvid := "" -}}
+ {{if .Get "id"}}
+ {{$bvid = .Get "id"}}
+ {{else if .Get 0}}
+ {{$bvid = .Get 0}}
+ {{end}}
+ {{if $bvid}}
+ <iframe
+ style="position: absolute; top: 0; left: 0;"
+ width="100%"
+ height="100%"
+ src="//player.bilibili.com/player.html?aid=123456&bvid={{ $bvid }}&cid=123456&page=1"
+ scrolling="no"
+ border="0"
+ frameborder="no"
+ framespacing="0"
+ allowfullscreen="true"
+ >
+ </iframe>
+ {{else}}
+ <h6>请填写视频 url 中的视频 id,例如:BV1FV411d7u7</h6>
+ {{end}}
+</div>