{{- /*
Renders an embedded BiliBili video.
@param {string} [bvid] BiliBili 视频 ID, 如果未取到会尝试第一个位置参数
@param {int} [page] 视频分P, 从 1 开始
@returns {template.HTML}
@reference https://player.bilibili.com/
@example
@example
*/}}
<!-- Get arguments-->
{{- $bvid := .Get "bvid" | default (.Get 0) }}
{{- $page := .Get "page" | default (.Get 1) }}
<!-- Set style -->
<style>
.aspect-ratio {
position: relative;
width: 100%;
height: 0;
margin: 1em 0;
padding-bottom: 55%;
}
.aspect-ratio iframe {
position: absolute;
width: 100%;
height: 100%;
}
</style>
<!-- Render -->
<div class="aspect-ratio">
<iframe
src="//player.bilibili.com/player.html?bvid={{ $bvid }}{{ with $page }}&p={{ . }}{{ end }}&autoplay=false&muted=false"
allowfullscreen scrolling="no"></iframe>
</div>