Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何插入bilibili视频? #278

Closed
yezihack opened this issue Jun 5, 2020 · 4 comments
Closed

如何插入bilibili视频? #278

yezihack opened this issue Jun 5, 2020 · 4 comments

Comments

@yezihack
Copy link

yezihack commented Jun 5, 2020

No description provided.

@lryong
Copy link
Contributor

lryong commented Jul 19, 2020

@yezihack 提了一个 PR: feat: support BiliBili video, 利用 Hugo Shortcodes 插入 B 站视频 => Demo

食用方法

在想插入 B 站视频的地方使用 Shortcodes:

{{< bilibili [AV/BV号] [PV号] >}}

(AV 号不带 av/AV,BV 号必须带 bv/BV,PV 号控制分 P,默认为 1)

比如 {{< bilibili BV18a4y1t7ej >}} 或者 {{< bilibili 2271122 >}}

@yezihack
Copy link
Author

已经解决

@tanteng
Copy link

tanteng commented Mar 27, 2022

已经解决

请问如何设置高度宽度?默认太小了

@RoderickChan
Copy link

RoderickChan commented Feb 10, 2023

已经解决

请问如何设置高度宽度?默认太小了

bilibili.html修改成我这样就可以了:

{{ $videoID := index .Params 0  }}
{{ $pageNum := index .Params 1 | default 1 }}

{{ if (findRE "^[bB][vV][0-9a-zA-Z]+$" $videoID)  }}
<div style="position:relative; padding-bottom:75%; width:100%; height:0">
  <iframe
          src="//player.bilibili.com/player.html?bvid={{ $videoID }}&page={{ $pageNum }}"
          scrolling="no"
          border="0"
          frameborder="no"
          framespacing="0"
          allowfullscreen="true"
          style="position:absolute; height: 100%; width: 100%;"
  >
  </iframe>
  </div>
{{ else  }}
<div style="position:relative; padding-bottom:75%; width:100%; height:0">
  <iframe
          src="//player.bilibili.com/player.html?aid={{ $videoID  }}&page={{ $pageNum  }}"
          scrolling="no"
          border="0"
          frameborder="no"
          framespacing="0"
          allowfullscreen="true"
          style="position:absolute; height: 100%; width: 100%;"
  >
  </iframe>
  </div>
{{ end  }}

演示链接点我

daymade pushed a commit to daymade/hugo-theme-even that referenced this issue Sep 30, 2023
Closes olOwOlo#278 

Co-authored-by: Herbert Lu <ry.lu@aftership.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants