It has been 1486 days since the last update, the content of the article may be outdated.
记录我对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="top-flag">Highlighted</p> - let link = article.link || article.path - let title = article.title || _p('no_title')
使用注入方式设置样式,主题配置文件:
inject: head: - '<style>.top-flag{display:inline-block;text-align:center;width:280px;line-height:20px;position:absolute;top:20px;right:-110px;z-index:2;overflow:hidden;transform:rotate(45deg);-ms-transform:rotate(45deg);-moz-transform:rotate(45deg);-webkit-transform:rotate(45deg);-o-transform:rotate(45deg);border:1px dashed;box-shadow:0 0 0 1px #fff,0 21px 5px -18px rgba(0,0,0,.6);background-color:#eef3fc;color:#2160c4;font-size:12px}</style>' - '<style>.recent-post-item{position:relative;overflow:hidden}</style>'
效果
Label标签高亮 在Hexo-Next主题中使用的较多,在此扩展到Butterfly上。效果就是给文本加上有颜色的高亮。 使用方法:
{% label [class]@Text %} * * [class] : default | primary | success | info | warning | danger. * If not defined, default class will be selected.
这是一个闭合标签,不需要{% endlabel %}
这种形式,例如: `