Closed Myer921 closed 7 years ago
如果有更好方案,欢迎探讨
倒不如说是hexo设计的问题,但是我这么懒的人 会使用
<!-- more -->
这样的标签避免主页出现a/dplayer (虽然自己并不用
<!-- more -->
这个要怎么用?????
嗯。。。我找遍了hexo源码,但没有找到可以在渲染theme时用的filter。。。建议要是大量使用dplayer就改模板吧,小量使用可以这样使用:
---
title: 标题
date: 2333-33-33 33:33:33
tags:
---
#标题
正文(提纲)
<!-- more -->
{% raw %}
<div id="player1" class="dplayer"></div>
<script src="dist/DPlayer.min.js"></script><!-- 注意,这行在more注释之后 -->
<script>
var option = {
element: document.getElementById('player1'), // Optional, player element
autoplay: false, // Optional, autoplay video, not supported by mobile browsers
theme: '#FADFA3', // Optional, theme color, default: #b7daff
loop: true, // Optional, loop play music, default: true
lang: 'zh', // Optional, language, `zh` for Chinese, `en` for English, default: Navigator language
screenshot: true, // Optional, enable screenshot function, default: false, NOTICE: if set it to true, video and video poster must enable Cross-Origin
hotkey: true, // Optional, binding hot key, including left right and Space, default: true
preload: 'auto', // Optional, the way to load music, can be 'none' 'metadata' 'auto', default: 'auto'
video: { // Required, video info
url: '若能绽放光芒.mp4', // Required, video url
pic: '若能绽放光芒.png' // Optional, music picture
},
danmaku: { // Optional, showing danmaku, ignore this option to hide danmaku
id: '9E2E3368B56CDBB4', // Required, danmaku id, NOTICE: it must be unique, can not use these in your new player: `https://dplayer.daoapp.io/list`
api: 'https://dplayer.daoapp.io/', // Required, danmaku api
token: 'tokendemo', // Optional, danmaku token for api
maximum: 1000 // Optional, maximum quantity of danmaku
}
}
var dp = new DPlayer(option);
</script>
{% endraw %}
我才看到这文章日期,豆子你这么作死真的好吗?
你不说我都没注意到 目测我电脑时间错乱了
玩的真好 未来的豆子你好
在一部分主题中,主题会将所有文章内容放到首页中,但这样会导致了aplayer以及dplayer插件js的重复加载 (打开控制台 看看是不是多了好几行的dplayer的标识) 这对于用户访问来说是不好的 暂行解决方案 修改/hexo网站目录/node_modules/hexo-tag-(括号删除,这里填你要编辑的插件,aplayer写a,dplayer写d)player/index.js
将此段代码注释,并魔改主题
修改主题目录的head.js文件
在
</head>
前一行添加 请根据需要添加对应行并执行一次
让其生效