Skip to content

修改配置文件

Hexo配置文件(_config.yml)

打开blog目录下的Hexo的配置文件 _config.yml,进行自定义配置。(以下显示是通用配置)

yaml
language: zh-CN
timezone: 'Asia/Shanghai'

deploy:
  type: 'git'
  repository: #仓库地址
  branch: main #分支一般是master、main

Butterfly配置文件(_config.butterfly.yml)

打开blog目录下的Butterfly配置文件_config.butterfly.yml,进行自定义修改配置。(以下显示是通用配置)

yaml
nav:
  logo: #左上角头像地址
#页面icon  
favicon: #头像地址
#侧边栏处头像
avatar:
  img: #头像地址
  effect: false
#首页背景图
index_img:
#文章卡片默认显示图,可多个
  default_cover:
  
post_meta:
  # Home Page
  page:
    # Choose: created / updated / both
    date_type: both #显示文章的创建和更新时间
    # Choose: date / relative
    date_format: date
    updated: 2025-07-05 19:19:52
categories: true
    tags: false
    label: true
  post:
    # Choose: left / center
    position: center #文章页meta信息居中显示
    # Choose: created / updated / both
    date_type: both
    # Choose: date / relative
    date_format: date
    updated: 2025-07-05 19:19:52
categories: true
    tags: true
    label: true
    
#首页卡片双栏布局
index_layout: 7
#选择首页卡片双栏布局时,关闭主页文章节选,不会出现卡片混乱的情况
index_post_content:
  method: false
  
#展示文章版权和许可协议
post_copyright:
  enable: true
  decode: false
  author_href: #网站地址
  license: CC BY-NC-SA 4.0
  license_url: https://creativecommons.org/licenses/by-nc-sa/4.0/
  
#文章分页,下一篇为新文章
post_pagination: 2

#页脚信息
footer:
  owner:
    enable: true
    since: #年份
  custom_text: #自定义
  # Copyright of theme and framework
  copyright: false
  
#侧边栏
aside:
  enable: true
  hide: false
  button: true
  mobile: true
  #侧边栏位置
  position: right
  display:
    archive: false
    tag: true
    category: true
  card_author:
    enable: true
    description:
    #关闭头像下的github按钮
    button:
      enable: false
      icon: fab fa-github
      text: Follow Me
      link: https://xxxxxxx
   #关闭通告
  card_announcement:
    enable: false
    content: This is my Blog
  card_recent_post:
    enable: true
    limit: 5
    sort: date
    sort_order:
  card_newest_comments:
    enable: false
    sort_order:
    limit: 6
    storage: 10
    avatar: true
  card_updated: 2025-07-05 19:19:52
categories:
    enable: true
    limit: 8
    expand: none
    sort_order:
  card_tags:
    enable: true
    limit: 10
    #标签显示颜色
    color: true
    orderby: random
   #升序排序
    order: 1
    sort_order:
  card_archives:
    enable: true
    type: monthly
    #YYYY年MM月
    format: YYYY MMMM
    order: -1
    limit: 8
    sort_order:
  #系列文章卡片
  card_post_series:
    enable: true
    series_title: true
   #按标题排序
    orderBy: 'title'
    #升序
    order: 1
  card_webinfo:
    enable: true
    post_count: true
    last_push_date: true
    sort_order:
    #网站开始运行时间
    runtime_date:
 
 #系列文章
 series:
  enable: true
  orderBy: 'title'
  order: 1
  number: true   
  
 #滚动百分比显示
 rightside_scroll_percent: true
 #字数统计
 wordcount:
   enable: true
   
#搜索
search:
  use: local_search
  placeholder: 搜索文章


  local_search:
    preload: false
    top_n_per_article: -1
    unescape: false
    CDN:
#评论配置选择Giscus
comments:
  use: Giscus
  text: true
  lazyload: false
  count: true
  card_post_count: true
  
  
giscus:
  repo: #仓库地址
  repo_id: #giscus仓库id
  category_id: ##giscus category的id
  theme:
    light: light
    dark: dark
  option:
     data-lang: zh-CN #设置中文显示
     data-input-position: bottom 
     
#页面美化
beautify:
  enable: true
  field: post
  title_prefix_icon: '\f0c1'
  title_prefix_icon_color: '#F47466'
  
#主页subtitle
subtitle:
  enable: true
  effect: true
  typed_option:
  source: 1 #一言
  sub: #自定义
#图片大图查看模式
lightbox: fancybox

#Mermaid
mermaid:
  enable: true
  code_write: true
  theme:
    light: default
    dark: dark
   
# 图片懒加载
lazyload:
  enable: true
  field: site # site/post
  placeholder:
  blur: false

Butterfly配置文件详细配置见官方文章,原链接如下: