Skip to content
Yusen edited this page Nov 25, 2017 · 20 revisions

站点配置

编辑站点配置文件,hexo/_config.yml

启用主题

theme: indigo

基本配置

为了得到更好的使用体验,以下内容请务必填写完整,因为这些内容会在主题中得到展示。更多

title: your title
subtitle: your subtitle
description: your description
keywords: your keywords
author: your name
email: your email
url: your site url

feed配置

参考 hexo-generator-feed

feed:
  type: atom
  path: atom.xml
  limit: 0

jsonContent配置

为了节约资源,可以对 jsonContent 插件生成的数据字段进行配置,减少数据文件大小。参考 hexo-generator-json-content

jsonContent:
  meta: false
  pages: false
  posts:
    title: true
    date: true
    path: true
    text: true
    raw: false
    content: false
    slug: false
    updated: false
    comments: false
    link: false
    permalink: false
    excerpt: false
    categories: false
    tags: true

主题配置

编辑主题配置文件,themes/indigo/_config.yml

左侧菜单

默认配置如下

menu:
  home:
    text: 主页
    url: /
  archives:
    url: /archives
  tags:
    url: /tags
  github:
    url: https://github.com/yscoder
    target: _blank
  weibo:
    url: http://www.weibo.com/ysweb
    target: _blank
  link:
    text: 测试
    url: /

添加新菜单项时,在 menu 下增加子属性即可。属性说明如下:

menu:
 link:               # fontawesome图标,省略前缀,本主题前缀为 icon-,必须
   text: About       # 菜单显示的文字,如果省略即默认与图标一致,首字母会转大写
   url: /about       # 链接,绝对或相对路径,必须
   target: _blank    # 是否跳出,省略则在当前页面打开

fontawesome 图标已集成到主题中,你可以到 这个页面 挑选合适的图标。

rss

6.x 后移除该配置项,使用站点配置中的 feed 作为统一配置。

rss: /atom.xml

favicon

站点 logo,显示在浏览器当前标签页左上角。

favicon: /favicon.ico

头像

位于左侧菜单上方

avatar: /img/logo.jpg

email

头像下方

email: 634206017@qq.com

color

设置 Android L Chrome 浏览器状态栏颜色,不需要可去除此项或设为 false

color: '#3F51B5'

标签页 (old)

配置标签页标题

tags:
  title: 标签

页面标题 (card theme)

自定义归档、标签、分类页的大标题。

tags_title: Tags
archives_title: Archives
categories_title: Categories

文章摘要

可以在 Markdown 文件中加 <!--more-->以分割摘要与文章正文。未设置时,按 excerpt_length 设置截取。

# 文章摘要渲染方式: 为 true 时将渲染为 html,否则为文本
excerpt_render: false
# 截断长度
excerpt_length: 200
# 文字正文页链接文字
excerpt_link: 阅读全文...

mathjax

开启后,使你的站点支持公式渲染,by mathjax。 请按需开启,因为此项需要加载额外的 js 文件。

mathjax: false

分享

文章分享开关,by jiathis-api

share: true

文章打赏

默认开启

reward:
  title: 谢谢大爷~             #显示的文字
  wechat: /img/wechat.jpg     #微信,关闭设为 false
  alipay: /img/alipay.jpg     #支付宝,关闭设为 false

此外在 crad theme 中,可以通过在 markdown 头部添加 reward: false 来控制某些不想开启打赏的页面。

关闭

reward: false

二维码请自行从微信、支付宝中下载。当两个二维码同时存在时,为保持显示效果的一致性,注意截图时的边框留白保持一致。必要时可借助PS等图片处理工具进行图片大小裁剪、压缩等。

站内搜索

是否开启搜索

search: true

布局

开启后,文章页在大屏下会隐藏左侧菜单,专注阅读。

hideMenu: true

Toc

开启文章内容导航。

#toc: false  #关闭
toc:
  list_number: false  # 决定导航使用的标签, true 为 ol, false 为 ul。

copyright (card theme)

文章页版权声明内容,hexo中所有变量及辅助函数等均可调用,具体请查阅 hexo.io

copyright: 这里写留言或版权声明:<a href="<%- url_for(page.path) %>" target="_blank" rel="external"><%- url %></a>

less

设置 less 编译时的入口文件路径,hexo-renderer-less

less:
  compress: true    # 是否压缩css
  paths:
    - source/css/style.less

评论

集成了 disqus友言gitmentvaline,开启其一即可。

数据统计

集成的有谷歌、腾讯、百度和 CNZZ,请填写你的站点标识。

google_analytics: key
tajs: 站点id
baidu_tongji: 站点id
cnzz: 站点id

谷歌站点验证 (card theme)

google_site_verification: false

规范网址 (card theme)

让搜索引擎重定向你的不同域名、不同子域、同域不同目录的站点到你期望的路径。使用规范网址

canonical: http://imys.net

版权起始年份

since_year: 2006

自定义页面关于

用户页面中作者相关的描述性文字,如不需要设为 false

about: 用户页面中作者相关的描述性文字,如不需要设为 false

cdn

开启后将使用 unpkg cdn 最新的主题样式,如果想让你的自定义样式生效,把此项设为 false

cdn: true

lightbox

文章图片灯箱效果。

lightbox: true

ICP 备案号

ICP_license: 京ICP备1234556号-1