侧边栏与页脚
配置 blog 侧边挂件栏的位置与各挂件参数,以及页脚版权、运行时长、统计与备案信息。
侧边栏与页脚
侧边栏(Blog 模式)
1 2 3 4 5 6 7 8 9 10 11 12
| sidebar: position: right sticky: true widgets: - profile - recent_posts - categories - tagcloud - archive_list
|
| 配置项 |
说明 |
position |
left 左栏 / right 右栏 / none 不显示 |
sticky |
桌面档是否吸附(跟随滚动) |
widgets |
数组顺序即渲染顺序 |
侧边栏只属于
sidebar 配置仅在 mode: blog 下生效。notes 与 docs 模式的左栏是文档树 / 笔记树,由各自的分组数据驱动,不受 sidebar.widgets 影响。
挂件列表
profile 个人资料
1 2 3
| sidebar: profile: social: true
|
显示头像、站点标题(或作者名)、标语,以及社交图标。社交图标的数据来自 social 配置,见下文。
recent_posts 最新文章
1 2 3
| sidebar: recent_posts: count: 5
|
categories 分类
1 2 3 4
| sidebar: categories: count: 10 show_count: true
|
show_count 控制是否在分类名后显示文章数。
tagcloud 标签云
1 2 3 4
| sidebar: tagcloud: count: 30 colorful: true
|
colorful: true 时,标签按文章数量着色,权重越高颜色越深。
archive_list 归档
1 2 3 4 5
| sidebar: archive_list: count: 12 type: monthly
|
toc 目录
把 toc 加入 widgets 即可在侧栏显示文章目录:
1 2 3 4 5
| sidebar: widgets: - profile - toc - recent_posts
|
社交账号
1 2 3 4
| social: github: https://github.com/xfm0797 email: mailto:hi@example.com rss: /atom.xml
|
键名即图标名。主题按 theme.social 的键逐个查找内置同名图标(#xfm-i-<键名>),因此键名必须是图标库中存在的名字:
| 可用键名 |
说明 |
github twitter weibo qq wechat |
通用社交 |
bilibili zhihu juejin youtube |
国内平台 |
facebook instagram telegram whatsapp linkedin mastodon |
海外平台 |
email |
建议写 mailto:you@example.com |
rss |
站点订阅地址,如 /atom.xml |
值为空字符串的项会被自动过滤,不渲染。
social 同时用于两个位置:侧边栏 profile 挂件,以及移动端抽屉底部(layout/_partials/header.ejs 引入)。
友链
1 2 3 4 5
| links: - name: XFM 主题源码 url: https://github.com/xfm0797/hexo-theme-xfm avatar: /images/avatar.svg desc: 高端大气的 Hexo 三模式主题
|
字段:name(必填)、url(必填)、avatar(头像,可省)、desc(简介,可省)。
友链渲染在 type: links 的独立页面上:
生成的 source/links/index.md 加上 type:
1 2 3 4
| --- title: 友链 type: links ---
|
页脚
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| footer: enable: true since: runtime: false runtime_start: statistics: true custom: "" icp: police: police_code:
|
运行时长
1 2 3
| footer: runtime: true runtime_start: 2024-01-01
|
开启后页脚显示一个每秒刷新的计时器,格式为 X 天 X 时 X 分 X 秒。日期格式必须是 YYYY-MM-DD。
统计
1 2
| footer: statistics: true
|
显示全站文章数与累计字数。字数口径与文章页一致(中日韩按字符、拉丁按单词)。
自定义内容
1 2
| footer: custom: '<a href="https://beian.miit.gov.cn/">京ICP备xxxxxxxx号</a>'
|
支持任意 HTML,插入在版权行上方。
备案信息
1 2 3 4
| footer: icp: 京ICP备2024000000号 police: 京公网安备11010502000000号 police_code: 11010502000000
|
police 与 police_code 配合使用:显示备案号文本,并链接到公安备案查询页。
页脚统计占用组件开关
页脚的统计区块对应组件开关中的 footer_stats 键,可以在手机档单独隐藏:
1 2 3 4
| adaptive: tiers: mobile: disable: [footer_stats]
|
评论