🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

hexo-shoka-swiper

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
This package has malicious versions linked to the ongoing "Miasma Mini Shai-Hulud Supply Chain Attack" supply chain attack.

Affected versions:

0.1.10
View campaign page

hexo-shoka-swiper

A Slideshow and Cardshow plugin for theme-shoka based on swiper

latest
Source
npmnpm
Version
0.1.9
Version published
Weekly downloads
45
-61.86%
Maintainers
1
Weekly downloads
 
Created
Source

hexo-shoka-swiper

hexo-theme-shoka添加 首页轮播图

安装

  • 安装插件,在博客根目录下打开终端,运行以下指令:
npm install hexo-shoka-swiper --save
  • 添加配置信息,以下为写法示例 在站点配置文件_config.yml或者主题配置文件_config.shoka.yml中添加
  # hexo-shoka-swiper
  # 首页轮播图
  swiper:
    enable: true # 开关
    priority: 5 # 过滤器优先权
    enable_page: / # 应用页面
    exclude: # 屏蔽页面
      # - /posts/
      # - /about/
    timemode: date # date/updated
    layout: # 挂载容器类型
      type: class
      name: 'index wrap'
      index: 0
    error_img: /images/loading.gif # 封面图片加载失败的默认封面
    insertposition: afterbegin
    default_descr: 再怎么看我也不知道怎么描述它的啦!
    swiper_css: https://cdn.jsdelivr.net/npm/hexo-shoka-swiper/lib/swiper.min.css # swiper css 依赖
    swiper_js: https://cdn.jsdelivr.net/npm/hexo-shoka-swiper/lib/swiper.min.js # swiper js 依赖
    custom_css: https://cdn.jsdelivr.net/npm/hexo-shoka-swiper/lib/swiperstyle.css # 适配主题样式补丁
    custom_js: https://cdn.jsdelivr.net/npm/hexo-shoka-swiper/lib/swiper_init.js # swiper 初始化方法
  • 参数释义
参数备选值/类型释义
prioritynumber【可选】过滤器优先级,数值越小,执行越早,默认为10,选填
enabletrue/false【必选】控制开关
enable_pagepath/all【可选】填写想要应用的页面的相对路径(即路由地址),如根目录就填'/',分类页面就填'/categories/'。若要应用于所有页面,就填'all',默认为all
excludepath【可选】填写想要屏蔽的页面,可以多个。仅当enable_page为'all'时生效。写法见示例。原理是将屏蔽项的内容逐个放到当前路径去匹配,若当前路径包含任一屏蔽项,则不会挂载。
timemodedate/updated【可选】时间显示,date为显示创建日期,updated为显示更新日期,默认为date
layout.typeid/class【可选】挂载容器类型,填写id或class,不填则默认为id
layout.nametext【必选】挂载容器名称
layout.index0和正整数【可选】前提是layout.type为class,因为同一页面可能有多个class,此项用来确认究竟排在第几个顺位
error_imgurl封面图片加载失败时的替换图片
insertpositiontext'beforebegin':元素自身的前面。'afterbegin':插入元素内部的第一个子节点之前。'beforeend':插入元素内部的最后一个子节点之后。'afterend':插入元素自身的后面。
default_descrtext【可选】默认文章描述
swiper_cssurl【可选】自定义的swiper依赖项css链接
swiper_jsurl【可选】自定义的swiper依赖项加js链接
custom_cssurl【可选】适配主题样式补丁
custom_jsurl【可选】swiper初始化方法
  • 使用方法 在文章的front_matter中添加swiper_index配置项即可。
---
title: 文章标题
date: 创建日期
updated: 更新日期
cover: 文章封面
description: 文章描述
swiper_index: 1 # 置顶轮播图顺序,需填非负整数,数字越大越靠前
---

截图

Keywords

hexo

FAQs

Package last updated on 18 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts