# 魔改记录
码字不易，留个start再走！！！

## 1.menu菜单汉化
  /theme/buffifly_config.yaml的menu选项汉化

  ```code
    menu:
      主页: / || fas fa-home
      时间轴: /archives/ || fas fa-archive
      标签: /tags/ || fas fa-tags
      分类: /categories/ || fas fa-folder-open
      远方杂谈||fas fa-list:
        - 音乐 || /music/ || fas fa-music
        - 电影 || /movies/ || fas fa-video
      友情链接: /link/ || fas fa-link
      关于我的: /about/ || fas fa-heart
  ```

## 2.代码高亮
  ```
  //  /theme/buffifly_config.yaml

    highlight_theme: mac light 
  ```

## 3.copy-setting
```
# copy settings
# copyright: Add the copyright information after copied content (複製的內容後面加上版權信息)
    copy:
      enable: true
      copyright: true
```

## 4.Algolia(搜索)配置
下载[hexo-algoliasearch](https://github.com/LouisBarranqueiro/hexo-algoliasearch)
```
  npm install hexo-algoliasearch --save
```
在/theme/buffifly/_config.yaml添加
```
# search (搜索)
# --------------------------------------

# Algolia search
algolia_search:
  enable: true
  hits:
    per_page: 6

  labels:
    input_placeholder: 请输入搜索内容
    hits_empty: "对不起，我没有找到关于: ${query}的内容" # if there are no result
    hits_stats: '${hits} 发现结果在 ${time} ms'
```
到[algolia官网](https://www.algolia.com/)注册账号，然后登录***dashboard***，在左侧菜单找到ApiKey点击按钮

```
//将此配置粘贴与_admin-config.yaml同级的_config.yaml，插件（plugins下面，注意缩进用空格，最好不要用table键）
algolia:
  appId: "Application ID"
  apiKey: "Search-Only API Key"
  adminApiKey: "Admin API Key"
  chunkSize: 5000
  indexName: "your index name"
  fields:
    - content:strip:truncate,0,500
    - excerpt:strip
    - gallery
    - permalink
    - photos
    - slug
    - tags
    - title
```
然后新建Create Index，记住index name，然后把你的index name，Application ID，Search-Only API Key，
Admin API Key一一配置上去

## 4.配置本地搜索

安装[npm install hexo-generator-search --save](https://github.com/Wzpan/hexo-generator-search)

将下面配置复制到与_admin-config.yaml同级的_config.yaml，和algolia一样
```
# Search 
search:
  path: ./public/search.xml
  field: post
  format: html
  limit: 10000
```

path：索引文件的路径，相对于站点根目录
field：搜索范围，默认是 post，还可以选择 page、all，设置成 all 表示搜索所有页面
limit：限制搜索的条目数
在theme/buffifly/_config.yaml开启本地搜索
```
  local_search:
    enable: true
```

## 5.wordCount
安装hexo字数统计依赖
```
  yarn add hexo-wordcount
  # or
  npm i --save hexo-wordcount
```
然后配置到/theme/_config.yaml
```
  wordcount:
    enable: true
    post_wordcount: true
    min2read: true
    total_wordcount: true
```