首先找到分享嵌入代码
<iframe src="//player.bilibili.com/player.html?aid=29789749&cid=51852984&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
在markdown中使用嵌入代码
调整大小和居中等
<!--
调整大小: width="xxx" height="xxx"
-->
<iframe src="//player.bilibili.com/player.html?aid=29789749&cid=51852984&page=1" width="600" height="400" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>
matery 主题修改首页展示视频
找到 /themes/hexo-theme-matery/layout/_widget/video.ejs 将第十一行左右代码改成Bilibili视频即可, 引入的 script 可以删掉.
修改后如下.
<link rel="stylesheet" href="<%- theme.jsDelivr.url %><%- url_for(theme.libs.css.dplayer) %>">
<div class="video-player">
<% if (theme.video.showTitle) { %>
<div class="title center-align">
<i class="fas fa-video-camera"></i> <%= 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=29789749&cid=51852984&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>
</div>
1.把上面的aid和cid替换成你想嵌入的视频id
2.去主题文件夹下的_config文件中把首页显示视频选项设置为true