Fork me on GitHub

Hexo插入其他资源

前言

Hexo插入音频/视频/PDF等资源,可以丰富博客表现内容.

插入音频

iframe标签

网易云音乐或者虾米音乐获取代码



将代码添加到Markdown文档中

1
<iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width=330 height=86 src="//music.163.com/outchain/player?type=2&id=29750751&auto=1&height=66"></iframe>

效果如下:

注释:生成音乐链接过程中有些选项可以自己调节,例如是否直接播放、播放器尺寸大小等 ## embed标签 ![](/492e1856/03.png)
1
<embed src="//music.163.com/style/swf/widget.swf?sid=29750751&type=2&auto=1&width=320&height=66" width="340" height="86"  allowNetworking="all"></embed>

效果如下:

javascript标签举例

1
<script type="text/javascript" src="http://www.xiami.com/widget/player-single?uid=5885327&sid=1774273389&mode=js"></script>

效果如下:

插件

hexo-tag-aplayer:https://github.com/grzhan/hexo-tag-aplayer
使用方法

1
$ npm install hexo-tag-aplayer --save

Markdown文档中插入如下代码:

1
{% aplayer title author url [picture_url, narrow, autoplay, width:xxx, lrc:xxx] %}

参数说明:

  • title : music title
  • author: music author
  • url: music file url
  • picture_url: optional, music picture url
  • narrow: optional, narrow style
  • autoplay: optional, autoplay music, not supported by mobile browsers
  • width:xxx: optional, prefix width:, player’s width (default: 100%)
  • lrc:xxx: optional, prefix lrc:, LRC file url
    效果如下:

插入视频

hexo-tag-dplayer: https://github.com/NextMoe/hexo-tag-dplayer
使用方法:

1
$ npm install hexo-tag-dplayer

Markdown文档中插入如下代码:

1
{% dplayer key=value ... %}

key can be

1
2
3
4
5
6
7
8
dplayer options:
'autoplay', 'loop', 'screenshot', 'hotkey', 'mutex', 'dmunlimited' : bool options, use "yes" "y" "true" "1" "on" or just without value to enable
'preload', 'theme', 'lang', 'logo', 'url', 'pic', 'thumbnails', 'vidtype', 'suburl', 'subtype', 'subbottom', 'subcolor', 'subcolor', 'id', 'api', 'token', 'addition', 'dmuser' : string arguments
'volume', 'maximum' : number arguments
container options:
'width', 'height' : string, used in container element style
other:
'code' : value of this key will be append to script tag

插入PDF

hexo-pdf
使用方法:

1
$ npm install --save hexo-pdf

在Markdown文档中添加如下配置:

1
2
3
4
5
6
7
8
Normal PDF
{% pdf http://7xov2f.com1.z0.glb.clouddn.com/bash_freshman.pdf %}
or
{% pdf ./bash_freshman.pdf %}
Google drive
{% pdf https://drive.google.com/file/d/0B6qSwdwPxPRdTEliX0dhQ2JfUEU/preview %}
Slideshare
{% pdf http://www.slideshare.net/slideshow/embed_code/key/8Jl0hUt2OKUOOE %}

注:第一次用可能经常会报错,有报错直接F12调试资源加载链接报错修改资源目录即可,多数情况为目录设置不对

希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/492e1856.html
版权声明:转载请注明出处!

坚持技术分享,您的支持将鼓励我继续创作!