项目作者: fan-lv

项目描述 :
hexo-theme
高级语言: Stylus
项目地址: git://github.com/fan-lv/Fan.git
创建时间: 2019-02-11T02:26:54Z
项目社区:https://github.com/fan-lv/Fan

开源协议:

下载


Fan

这是一个深色主题,如梦幻般的星空,群星闪烁。


Preview

Install

  1. git clone https://github.com/fan-lv/Fan.git themes/Fan

修改位于博客根目录下的 _config.yml 内的 theme 选项值为 Fan

Update

  1. cd themes/Fan
  2. git pull

Required packages

  • hexo-renderer-jade
  • hexo-renderer-stylus

若报错 extends includes/layout.pug block content include includes/recent-posts.pug include includes/pagination.pug

安装依赖包,重新生成

  1. npm install --save hexo-renderer-jade hexo-renderer-stylus

Notes: 有说 hexo-renderer-jade 包过期的,可以用 hexo-renderer-pug

其他扩展依赖包参考

  1. npm install --save hexo-generator-feed hexo-generator-sitemap hexo-generator-archive hexo-browsersync

Questions

  • 若报错 layout\includes\config.pug:1, Cannot read property 'appId' of undefined, 需要把 themes -> _config.ymlalgolia_search:enable 改成 false

Feature

Top article

支持文章置顶功能,在需要置顶的文章(Markdown 文件)加入 top: 1,数值越大越靠前。

如:

  1. title: xxx
  2. author: xxx
  3. tags:
  4. - xxx
  5. categories:
  6. - xxx
  7. date: xxx
  8. top: 1

Comments

目前支持 GitmentValine 评论。

使用方法:

  1. 在根目录下 _config.yml 文件中加入以下代码,["gitment", "valine"] 配置自行选择一个,第二步中选择使用哪个

    1. comments:
    2. gitment:
    3. enable: true
    4. owner: 'Your GitHub ID'
    5. repo: 'The repository to store your comments. Make sure you're repo's owner'
    6. client_id: 'GitHub client ID'
    7. client_secret: 'GitHub client secret'
    8. # 可以自由配置 valine 的其他配置项
    9. valine:
    10. appId: 'Your appId'
    11. appKey: 'Your appKey'
    12. placeholder: 'xxx'
    13. ...(valine配置项,参考链接 https://valine.js.org/configuration.html)
  2. themes -> _config.yml 中可以开启或关闭 comments,并且通过 type 指定使用的评论插件

    1. # 评论
    2. comments:
    3. enable: true
    4. # 使用哪种评论插件["gitment", "valine"]
    5. type: "valine"
  1. 注册 Algolia账户,创建新的 Index,记下 index name

  2. 安装扩展

    1. npm install hexo-algolia --save
  3. 修改 Algolia 搜索 ACL(访问控制列表)
    默认的 Search-Only API Key 不能修改,需要在 All API Keys -> New API Key

    勾选 ACLs: search addObject deleteObject listIndexes deletelndex

    执行安装

    1. export HEXO_ALGOLIA_INDEXING_KEY=New API Key
    2. hexo algolia

    Notes: Mac 和 git bash 为 export, Windows 为 set, Powershell 用 $env

  4. 获取 Key,更新站点根目录配置

    1. algolia:
    2. applicationID: 'Application ID'
    3. apiKey: 'New API Key'
    4. indexName: 'index name'
  5. 主题配置下开启 Algolia_search

    1. algolia_search:
    2. enable: true
    3. hits:
    4. per_page: 10

    注意,每次更新文章后记得执行 hexo algolia 更新索引。

主题预览图

License

MIT