Hexo:Butterfly主题魔改之首页置顶轮博插件

封面

原文链接:Hexo:Butterfly主题魔改之首页置顶轮博插件 | Elvin

一、初始效果pic_1


二、安装插件

npm install hexo-butterfly-swiper --save

三、配置插件

_config.yml配置文件或自定义的主题配置文件(我的是_config.butterfly.yml)下增加以下配置

# hexo-butterfly-swiper
# see https://akilar.top/posts/8e1264d1/
swiper:
  enable: true # 开关
  priority: 5 #过滤器优先权
  enable_page: all # 应用页面
  timemode: date #date/updated
  layout: # 挂载容器类型
    type: id
    name: recent-posts
    index: 0
  default_descr: 再怎么看我也不知道怎么描述它的啦!
  swiper_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css #swiper css依赖
  swiper_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js #swiper js依赖
  custom_css: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiperstyle.css # 适配主题样式补丁
  custom_js: https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper_init.js # swiper初始化方法

四、插件参数

参数备选值/类型释义
prioritynumber【可选】过滤器优先级,数值越小,执行越早,默认为10,选填
enabletrue/false【必选】控制开关
enable_pagepath/all【可选】填写想要应用的页面的相对路径(即路由地址),如根目录就填’/‘,分类页面就填’/categories/‘。若要应用于所有页面,就填’all’,默认为all
timemodedate/updated【可选】时间显示,date为显示创建日期,updated为显示更新日期,默认为date
layout.typeid/class【可选】挂载容器类型,填写id或class,不填则默认为id
layout.nametext【必选】挂载容器名称
layout.index0和正整数【可选】前提是layout.type为class,因为同一页面可能有多个class,此项用来确认究竟排在第几个顺位
default_descrtext默认文章描述
swiper_cssurl【可选】自定义的swiper依赖项css链接
swiper_jsurl【可选】自定义的swiper依赖项加js链接
custom_cssurl【可选】适配主题样式补丁
custom_jsurl【可选】swiper初始化方法

五、使用方法

在文章的front_matter处添加swiper_index的配置即可

title: 建站首发:Markdown语法开篇
tags:
  - Markdown
  - 语言
categories: 语言
sticky: 1
katex: true
cover: http://qiniu.gocit.cn/blog_posts_1/cover_img.jpeg
top_img: http://qiniu.gocit.cn/blog_posts_1/top_img.png
date: 2022-08-02 09:28:56
abbrlink: 1
swiper_index: 1
description: 务必阅读:适用于新手快速入门的Markdown语法使用教程,运用Markdown语法是建立blog的必要前提!zf
  • swiper_index #置顶轮播图顺序,非负整数,数字越大越靠前
  • description #文章描述
  • abbrlink #永久链接id (具体可看【传送门】

六、最终效果pic_2


借鉴链接

Swiper Bar


更多知识持续更新中!!!


声明

借鉴部分均注明了原文出处,可在文章的借鉴链接处获取原文出处

文中若内容有涉及原版权,请邮件联系elvin-chen@qq.com,涉及的相关文章或内容将会及时更改或取消发布

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值