🚀快速开始 -->🌈基本配置 -->🏆界面显示 -->🎨特殊功能
👉👉 注意:以下配置均在根目录新建的 <root>/_config.shoka.yml
# 站点别称
alternate: Yume Shoka |
这里设置的名称为网页居中的 LOGO,以及页尾的 ©️ 处
# 静态文件目录
static: / | |
# static: //cdn.jsdelivr.net/gh/amehime/shoka@latest/ |
默认值为 / ,使用本地静态文件
也可以使用 jsDelivr 进行加速。形如 //cdn.jsdelivr.net/gh/您的github用户名/您的项目名@latest/
css: css | |
js: js | |
images: images |
静态文件所处目录的实际目录名,一般不修改
# 夜间模式
darkmode: # true |
此项一般不设置,是否开启夜间模式取决于(优先级从高到低)
- 用户点击页面头部切换按钮
- 用户切换浏览设备的主题
- 设置的 darkmode 配置
# 自动定位
auto_scroll: # false |
默认情况下,再次打开页面是,会自动定位到上次浏览的位置
设置为 false 时关闭
# 加载动画
# 是否显示页面加载动画 loading-cat | |
loader: | |
start: true # 当初次打开页面时,显示加载动画 | |
switch: true # tab 切换到其他页面时,显示加载动画 |
切换 tab 时只是显示 loading 动画,实际并未重新加载页面
# 加载动画替换
对应的 CSS 样式文件: ./themes/shoka/source/css/_common/components/third-party/loading.styl
对应的 HTML 文件: ./themes/shoka/layout/_partials/layout.njk
//css | |
// 保留下面这几行,其余删除后写入新样式 | |
#loading { | |
@extend $fix-fullscreen; | |
background-color: var(--grey-1); | |
if(!hexo-config('loader.start')) { | |
display: none; | |
} | |
} | |
// | |
// 填入你的 CSS 样式代码 | |
// |
<!--HTML--> | |
<body itemscope itemtype="https://schema.org/WebPage"> | |
<div id="loading"> | |
<!-- 删除此处内容并重新写入 css 样式对应的 html 代码 --> | |
</div> | |
<div id="container"></div> | |
</body> |
# 单击烟花特效
fireworks: | |
enable: true # 是否启用 | |
color: # 烟花颜色 | |
- "rgba(255,182,185,.9)" | |
- "rgba(250,227,217,.9)" | |
- "rgba(187,222,214,.9)" | |
- "rgba(138,198,209,.9)" |
# 加载谷歌字体
font: | |
enable: true | |
# Font options: | |
# `external: true` will load this font family from `host` above. | |
# `family: Times New Roman`. Without any quotes. | |
# `size: x.x`. Use `em` as unit. Default: 1 (16px) | |
# Global font settings used for all elements inside <body>. | |
global: | |
external: true | |
family: Mulish | |
size: | |
# Font settings for alternate title. | |
logo: | |
external: true | |
family: Fredericka the Great | |
size: 3.5 | |
# Font settings for site title. | |
title: | |
external: true | |
family: Noto Serif JP | |
size: 2.5 | |
# Font settings for headlines (<h1> to <h6>). | |
headings: | |
external: true | |
family: Noto Serif SC | |
size: | |
# Font settings for posts. | |
posts: | |
external: true | |
family: | |
# Font settings for <code> and code blocks. | |
codes: | |
external: true | |
family: Inconsolata |
以上设置建议默认
# iconfont 图标
shoka 主题作者在 Iconfont 上重新建立了一个项目font-famliy 设置为 ic ,所有的字体样式前缀均为 i- ,具体参见 <root>/thems/shoka/source/css/_iconfont.styl
如果想要添加或修改,需要前往 原作者 评论处留言告知 iconfont 用户名,请作者添加到项目中。
# 菜单和社交按钮
menu: | |
home: / || home | |
about: /about/ || user | |
posts: | |
default: / || feather | |
archives: /archives/ || list-alt | |
categories: /categories/ || th | |
tags: /tags/ || tags | |
# friends: /friends/ || heart | |
# links: /links/ || magic | |
social: | |
github: https://github.com/yourname || github || "#191717" | |
#google: https://plus.google.com/yourname || google | |
twitter: https://twitter.com/yourname || twitter || "#00aff0" | |
zhihu: https://www.zhihu.com/people/yourname || zhihu || "#1e88e5" | |
music: https://music.163.com/#/user/home?id=yourid || cloud-music || "#e60026" | |
weibo: https://weibo.com/yourname || weibo || "#ea716e" | |
about: https://about.me/yourname || address-card || "#3b5998" | |
#email: mailto:yourname@mail.com || envelope || "#55acd5" | |
#facebook: https://www.facebook.com/yourname || facebook | |
#stackoverflow: https://stackoverflow.com/yourname || stack-overflow | |
#youtube: https://youtube.com/yourname || youtube | |
#instagram: https://instagram.com/yourname || instagram | |
#skype: skype:yourname?call|chat || skype | |
#douban: https://www.douban.com/people/yourname/ || douban |
此配置对应页面中用户信息状态栏下的链接和顶部导航栏
如上,使用 || 作为分隔符,依次为 链接 || 图标 || 颜色 。
注意,只需要写图标名称,如 github ,则会自动转换为 ic i-github 。
十六进制颜色码需要 "" 包绕。
menu 支持一级子目录,子目录设置中的第一项必须为 default ,用来定义父级按钮的样式。
菜单显示文字可以在语言包中定义,查看具体配置
# 边栏(用户信息栏)配置
边栏可以选择在左侧或者右侧
sidebar: | |
# Sidebar Position. | |
position: left | |
#position: right | |
# Replace the default avatar image and set the url here. | |
avatar: avatar.jpg |
修改头像文件的位置,相对于静态文件目录 images 中配置的路径
可以将自己的图片放在 <root>/source/_data/images/ 目录下,甚至以同名覆盖主题内默认的头像图片,查看具体配置。
# 底部 widgets
目前页面底部可以显示两个小部件,即 随机文章 和 最近评论 。
widgets: | |
random_posts: true # 显示随机文章 | |
recent_comments: true # 显示最近评论 |
# 字数及阅读时间统计
安装好 hexo-symbols-count-time 插件后,不需要修改站点配置文件,直接使用插件默认配置就行。
# 文章评论
使用的是 LeanCloud 。无需注册即可评论,检索如何注册 LeanCloud。进行如下配置
valine: | |
appId: #Your_appId | |
appKey: #Your_appkey | |
placeholder: ヽ(○´∀`)ノ♪ # Comment box placeholder | |
avatar: mp # Gravatar style : mp, identicon, monsterid, wavatar, robohash, retro | |
pageSize: 10 # Pagination size | |
lang: zh-CN | |
visitor: true # 文章访问量统计 | |
NoRecordIP: false # 不记录 IP | |
serverURLs: # When the custom domain name is enabled, fill it in here (it will be detected automatically by default, no need to fill in) | |
powerMode: true # 默认打开评论框输入特效 | |
tagMeta: | |
visitor: 新朋友 | |
master: 主人 | |
friend: 小伙伴 | |
investor: 金主粑粑 | |
tagColor: | |
master: "var(--color-orange)" | |
friend: "var(--color-aqua)" | |
investor: "var(--color-pink)" | |
tagMember: | |
master: | |
# - hash of master@email.com | |
# - hash of master2@email.com | |
friend: | |
# - hash of friend@email.com | |
# - hash of friend2@email.com | |
investor: | |
# - hash of investor1@email.com |
tag 标签显示在评论者名字的后面,默认是 tagMeta.visitor 对应的值。
在 tagMeta 和 tagColor 中,除了 visitor 这个 key 不能修改外,其他 key 都可以换一换,但需要保证一致性。例如:
tagMeta: | |
visitor: 游客 | |
admin: 管理员 | |
waifu: 我老婆 | |
tagColor: | |
visitor: "#855194" | |
admin: "#a77c59" | |
waifu: "#ed6ea0" | |
tagMember: | |
admin: | |
# - hash of admin@email.com | |
waifu: | |
# - hash of waifu@email.com |
在文章 Front Matter 中也可以配置上述参数,访问该文章页面时,将覆盖全局配置。
尤其可以用来配置一个特殊的 placeholder 。
valine: | |
placeholder: "1. 提问前请先仔细阅读本文档⚡\n2. 页面显示问题💥,请提供控制台截图📸或者您的测试网址\n3. 其他任何报错💣,请提供详细描述和截图📸,祝食用愉快💪" | |
--- |
评论通知与管理工具建议使用这个 Valine-Admin。
注意 SITE_URL 需要以 / 结尾。
如果某一篇文章需要关闭评论功能,则在文章 Front Matter 中配置:
--- | |
title: 关闭评论 | |
comment: false | |
--- |
# 背景音乐
在主题配置文件中,设置全局播放列表。
在文章的 Front Matter 中,设置文章专有播放列表,访问该文章页面时,将覆盖全局配置。
audio: | |
- https://music.163.com/song?id=1387098940 | |
- https://music.163.com/#/playlist?id=2088001742 | |
- https://www.xiami.com/collect/250830668 | |
- https://y.qq.com/n/yqq/playsquare/3535982902.html |
如上,可以直接使用网易云、虾米、QQ 音乐的播放列表、单曲,可以同时填写多个。
audio: | |
- title: 列表1 | |
list: | |
- https://music.163.com/#/playlist?id=2943811283 | |
- https://music.163.com/#/playlist?id=2297706586 | |
- title: 列表2 | |
list: | |
- https://music.163.com/#/playlist?id=2031842656 |
如果要关闭当前页面的背景音乐播放器,则在文章 Front Matter 中配置:
--- | |
title: 关闭背景音乐 | |
audio: false | |
--- |
# 随机图库
- 默认的图片列表位于
<root>/themes/shoka/\_images.yml中。
使用了渣浪图库,使用一些上传工具,比如这里
上传后图片的链接是http://wx4.sinaimg.cn/large/ 6833939bly1gicmnywqgpj20zk0m8dwx.jpg。
只需要新一行写上- 6833939bly1gicmnywqgpj20zk0m8dwx.jpg。
如果想要自定义,则在<root>/source/_data/目录新建一个images.yml文件,这个文件中的图片至少 6 枚,将完全覆盖默认的图片列表。 - 也可以直接在图片列表 yml 文件中,写上任意外链图片地址
- https://i.loli.net/2020/10/30/qAMYEFXxJcKRsiG.gif | |
- https://i.loli.net/2020/10/30/rjdhcSgEN8COBPA.jpg | |
- https://i.loli.net/2020/10/30/HKyzSd7NI3mlBpt.jpg | |
- https://i.loli.net/2020/10/30/Y1CBXqgeokEs457.jpg | |
- https://i.loli.net/2020/10/30/Z5W6r2BSoiThHG1.jpg |
- 也可以在主题配置文件中,设置图床 API:
image_server: "https://acg.xydwz.cn/api/api.php" |