avatar

Hexo中插入Bilibili视频

修改matery主题首页显示视频为Bilibili视频

在Markdown插入Bilibili视频, 并设置大小.

首先找到分享嵌入代码

Bilibili分享截图

<iframe src="//player.bilibili.com/player.html?aid=17963687&cid=29326684&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

在markdown中使用嵌入代码

调整大小和居中等

iframe标签属性设置


<!--
调整大小: width="xxx" height="xxx"
-->

<iframe src="//player.bilibili.com/player.html?aid=17963687&cid=29326684&page=1" width="600" height="400" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

设置自适应

<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
<iframe src="//player.bilibili.com/player.html?aid=17963687&cid=29326684&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"></iframe>
</div>

matery 主题修改首页展示视频

找到 /themes/hexo-theme-matery/layout/_widget/video.ejs 将第十一行左右代码改成Bilibili视频即可, 引入的 script 可以删掉.

修改后如下.

<div class="video-player">
<% if (theme.video.showTitle) { %>
<div class="title center-align">
<i class="fas fa-video-camera"></i>&nbsp;&nbsp;<%- theme.video.title %>
</div>
<% } %>
<div class="row">
<div class="col l8 offset-l2 m10 offset-m1 s12">
<div id="dplayer" class="dplayer-video">
<div style="position: relative; width: 100%; height: 0; padding-bottom: 75%;">
<iframe src="//player.bilibili.com/player.html?aid=16316393&cid=26620787&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true" style="position: absolute; width: 100%; height: 100%; left: 0; top: 0;"></iframe>
</div>
</div>
</div>
</div>
</div>
文章作者: liuzhihang
文章链接: https://liuzhihang.com/2019/09/14/hexo-inserts-bilibili-video.html
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Notes

评论