⚽站点配置4
数学公式
不要在标题里使用 mathjax 语法,toc 目录不一定能正确显示 mathjax,可能显示 mathjax 代码
建议使用 KaTex 获得更好的效果,下文有介绍!
修改 主题配置文件
:
mathjax:
enable: true
# true 表示每一页都加载mathjax.js
# false 需要时加载,须在使用的Markdown Front-matter 加上 mathjax: true
per_page: false
如果
per_page
设为true
,则每一页都会加载 Mathjax 服务。设为false
,则需要在文章Front-matter
添加mathjax: true
,对应的文章才会加载 Mathjax 服务。
然后你需要修改一下默认的 markdown
渲染引擎来实现 MathJax 的效果。
以下操作在你 hexo 博客的目录下 (不是 Anzhiyu 的目录):
安装插件
npm uninstall hexo-renderer-marked --save
npm install hexo-renderer-kramed --save
配置 hexo 根目录的配置文件
kramed:
gfm: true
pedantic: false
sanitize: false
tables: true
breaks: true
smartLists: true
smartypants: true
渲染器
卸载掉 marked 插件,安装 hexo-renderer-markdown-itopen in new window
npm un hexo-renderer-marked --save # 如果有安装这个的话,卸载
npm un hexo-renderer-kramed --save # 如果有安装这个的话,卸载
npm i hexo-renderer-markdown-it --save # 需要安装这个渲染插件
npm install katex @renbaoshuo/markdown-it-katex #需要安装这个katex插件
在 hexo 的根目录的_config.yml
中配置
markdown:
plugins:
- "@renbaoshuo/markdown-it-katex"
如需配置其它参数,请参考 katex 官网
搜索系统
记得运行 hexo clean
使用 hexo-algoliasearchopen in new window,请记得配置 fields 参数的 title
, permalink
和 content
你需要安装 hexo-algoliasearchopen in new window. 根据它的说明文档去做相应的配置。
修改 主题配置文件
algolia_search:
enable: true
hits:
per_page: 6
hexo 配置文件
# algolia搜索: https://github.com/LouisBarranqueiro/hexo-algoliasearch
algolia:
appId: "xxxx"
apiKey: "xxxx"
adminApiKey: "xxxx"
chunkSize: 5000
indexName: "hexo"
fields:
- content:strip:truncate,0,200
- excerpt:strip
- gallery
- permalink
- photos
- slug
- tags
- title
分享
只能选择一个分享服务商
评论
开启评论需要在 comments-use 中填写你需要的评论。
支持双评论显示,只需要配置两个评论(第一个为默认显示)
comments:
# Up to two comments system, the first will be shown as default
# Choose: Valine/Waline/Twikoo/
use: Twikoo,Waline # Twikoo/Waline
text: true # Display the comment name next to the button
# lazyload: The comment system will be load when comment element enters the browser's viewport.
# If you set it to true, the comment count will be invalid
lazyload: false
count: true # Display comment count in post's top_img
card_post_count: false # Display comment count in Home Page
use
使用的评论(请注意,最多支持两个,如果不需要请留空)
text
是否显示评论服务商的名字
lazyload
是否为评论开启 lazyload,开启后,只有滚动到评论位置时才会加载评论所需要的资源(开启 lazyload 后,评论数将不显示)
count
是否在文章顶部显示评论数
card_post_count
是否在首页文章卡片显示评论数
在线聊天
这些工具都提供了一个按钮可以打开/关闭聊天窗口。 主题也提供了一个集合主题特色的按钮来替换这些工具本身的按钮,这个聊天按钮将会出现在右下角里。 你只需要把 chat_btn
打开就行。
修改 主题配置文件
# Chat Button [recommend]
# It will create a button in the bottom right corner of website, and hide the origin button
chat_btn: true
为了不影响访客的体验,主题提供一个 chat_hide_show
配置 设为 true 后,使用工具提供的按钮时,只有向上滚动才会显示聊天按钮,向下滚动时会隐藏按钮。
修改 主题配置文件
# The origin chat button is displayed when scrolling up, and the button is hidden when scrolling down
chat_hide_show: true
如果使用工具自带的聊天按钮,按钮位置可能会遮挡右下角图标,请配置 rightside-bottom
调正右下角图标位置
最后更新于