嵌入视频

2021-01-01

该项为必选置项,map类型,包含站点嵌入视频信息

在项目目录 config.toml,可配置该项

配置

 1[site.markdown.video]
 2state = true
 3
 4[site.markdown.video.source]
 5"www.youtube.com" = "/embed"
 6"player.bilibili.com" = "/player.html"
 7"v.qq.com" = "/txp/iframe/player.html"
 8
 9[site.markdown.video.attribute]
10width = "560"
11height = "315"
12border = "0"
13scrolling = "no"
14frameborder = "no"
15framespacing = "0"
16allowfullscreen = "true"
Notice:
  • 该项所定义内容,在任意模板页均可使用

  • 该项为数组字典类型,支持配置多个非重名[name]配置项

释义


  1. source

设置嵌入视频的资源

  • key

    视频 host string 类型

  • value

    视频 path string 类型

  1. attribute

设置嵌入视频的属性

举例

  • markdown

    1![](//player.bilibili.com/player.html?aid=930778398&bvid=BV1JK4y1R7RL&cid=343612570&page=1 "video")
    
  • html

     1<p>
     2	<iframe
     3		src="//player.bilibili.com/player.html?aid=930778398&amp;bvid=BV1JK4y1R7RL&amp;cid=343612570&amp;page=1"
     4		title="video"
     5		height="315"
     6		border="0"
     7		scrolling="no"
     8		frameborder="no"
     9		framespacing="0"
    10		allowfullscreen="true"
    11		width="560"
    12		></iframe
    13	>
    14</p>
    
  • code

  • 如何获取视频地址?

    1. 打开视频页面,点击分享按钮

    2. 复制 iframe 中的 src