修复开启Pjax环境下Charts类插件异常加载
场景使用butterfly主题,success@配置全局吸底式播放器 ,需要开启Pjax服务,预加载站内资源。但是在使用’hexo-charts’,’hexo-calendar’时,出现对象重复创建导致的报错。
类似这样的插件,初始化时会受pjax影响无法二次渲染,只能刷新才能销毁原有的声明对象。报错信息:VM5117:1 Uncaught SyntaxError: Identifier ‘calendarChart’ has already been declared就是说下面这里重复初始化除了问题:calendar 插件的部分源码
<script type="text/javascript">....... let calendarChart = echarts.init(document.getElementById('calendar')); let endDate = new Date().getTime().......
求助网上的建议一大堆,有要求修改pjax源码的,有要修改pjax初始化绑定对象的 ...
Butterfly主题美化
记录我对butterfly主题的一些修改,持续更新。
置顶标签适用于已卸载自带的hexo-generator-index插件,添加使用hexo-generator-indexed插件实现置顶功能的小伙伴。在post类中的front-matter列表中使用sticky: 1 实现置顶,数字越大,置顶优先级越高。详见Butterfly 文档
修改themes\butterfly\layout\includes\mixins\post-ui.pug模板
mixin postUI(posts) each article , index in page.posts.data .recent-post-item if (is_home() && (article.top || article.sticky > 0)) ##判断是否有置顶属性sticky span.top-flag= _p('Highlighted') ##添加一个p标签<p class=" ...
Butterfly的一些特性
{% note default %}default 提示块标籤{% endnote %}{% note primary no-icon %}primary 提示块标籤{% endnote %}{% note success %}success 提示块标籤{% endnote %}{% note info %}info 提示块标籤{% endnote %}{% note warning %}warning 提示块标籤{% endnote %}{% note danger %}danger 提示块标籤{% endnote %}
default 提示块标籤
primary 提示块标籤
success 提示块标籤
info 提示块标籤
warning 提示块标籤
danger 提示块标籤
Gallery
壁 ...