- 新增腾讯视频的支持

- 支持通过frontmatter配置在文章中插入音频
This commit is contained in:
wood 2021-01-10 16:36:48 +08:00
parent 9366beacda
commit 82e642c751
4 changed files with 54 additions and 0 deletions

View File

@ -1,8 +1,18 @@
<article class="{{ if .Params.image }}has-image {{ end }}main-article">
{{ partial "article/components/header" . }}
{{ if .Params.audio }}
{{ if or ( eq .Params.audio.p "before" ) ( not .Params.audio.p ) }}
{{ partial "article/components/audio" . }}
{{ end }}
{{ end }}
{{ partial "article/components/content" . }}
{{ if or ( eq .Params.audio.p "after") ( eq .Params.audio.p "fixed" ) }}
{{ partial "article/components/audio" . }}
{{ end }}
{{ partial "article/components/footer" . }}
{{ if or .Params.math .Site.Params.article.math }}

View File

@ -0,0 +1,24 @@
<div style="margin: 20px;">
<meting-js style="margin: 10px;"
name="{{ .Params.audio.name }}"
artist="{{ .Params.audio.artist }}"
url="{{ .Params.audio.url }}"
{{ if .Params.audio.cover }}
cover="{{ .Params.audio.cover }}"
{{ else }}
cover="/images/logo.png"
{{ end }}
fixed="{{ eq .Params.audio.p "fixed" }}"
server="{{ .Params.audio.server }}"
type="{{ .Params.audio.type }}"
id="{{ .Params.audio.id }}"
autoplay="true"
loop="all"
order="list"
preload="auto"
list-folded="true"
list-max-height="500px"
theme="#999999"
lrc-type="1">
</meting-js>
</div>

View File

@ -32,4 +32,11 @@
{{ end }}
{{ partialCached "article/components/details" . .RelPermalink }}
{{ if .Params.audio }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script>
<!-- require MetingJS -->
<script src="https://cdn.jsdelivr.net/npm/meting@2.0.1/dist/Meting.min.js"></script>
{{ end }}
</header>

View File

@ -0,0 +1,13 @@
{{ $vid := (.Get 0) }}
<div style="position: relative; width: 100%; height: 0; padding-bottom: 56.25%;">
<iframe src="http://v.qq.com/iframe/player.html?vid={{ $vid }}&auto=0"
scrolling="no"
frameborder="no"
framespacing="0"
allowfullscreen="true"
style="position: absolute; width: 100%; height: 100%; padding: 20px;"
>
</iframe>
</div>