
阅读本篇之前,假定读者已经有了Node.js的基础,如需要补充Node.js知识的,请自行百度。
Hexo是在Node.js框架下的一个项目,利用Node.js提供的强大功能,完成从Markdown到静态网页的转换。
NexT是Hexo项目下的一个主题插件,提供可高度定制的页面外观。
本文章对Hexo站点配置文件_config.yml中的配置进行详细的讲解。
1. Hexo站点配置文件详解
Hexo版本为3.8.0,版本不同可能有不同
1# Hexo Configuration 2## Docs: https://hexo.io/docs/configuration.html 3## Source: https://github.com/hexojs/hexo/ 4 5# Site 6title: Hexo # 网站的标题,可能用在各种布局的页面中 7subtitle: # 网站子标题 8description: # 网站的描述性 9keywords: # 网站的关键字 10author: John Doe # 网站的作者 11language: # 网站采用语言,要跟/theme/***/languages/**.yml下的文件名对应。 12timezone: # 网站的时区 13 14# URL 15## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' 16url: http://yoursite.com # 网站的url,如果不在域名根目录,应包含子目录,且root要设置为`/子目录/` 17root: / # 网站的根目录 18permalink: :year/:month/:day/:title/ #文章永久链接的形成模版。每一篇文章都有唯一的url。 19permalink_defaults: #文章永久链接中,各部分的默认值。 20 21# Directory 22source_dir: source # 网站中源文件(比如Markdown啊什么的所在的文件夹) 23public_dir: public # 生成的静态网站的目录 24tag_dir: tags # 标签页所在的文件夹。 25archive_dir: archives # 文档页所在的文件夹 26category_dir: categories # 类别也所在的文件夹 27code_dir: downloads/code # 代码也所在的文件夹 28i18n_dir: :lang # 国际语言所在的文件夹 29skip_render: # 忽略文档清单 30 31# Writing 写作 32new_post_name: :title.md # 默认新建文档名,`:title`为变量,指文档标题,也可用其他变量 33default_layout: post # 新建文档的默认布局 34titlecase: false # 是否要把标题中的首字符大写 35external_link: true # 是否要在新开tab中打开外链 36filename_case: 0 # 文件名是否小写敏感 37render_drafts: false # 是否渲染草稿 38post_asset_folder: false # 是否启用资源文件夹。如启用,新建文档同时建立同名的资源文件夹 39relative_link: false # 是否把站内资源的链接改为站内相对链接。建议关闭。 40future: true # 文档中指定为未来时间创建 41highlight: 42 enable: true # 是否开启代码高亮功能 43 line_number: true # 代码块中是否在前面加上行号 44 auto_detect: false # 是否自动检测代码块的语言(比如xml、JavaScript、mermaid等) 45 tab_replace: # 用什么字符来代替tab(`\t`)字符。 46 47# Home page setting 48# path: Root path for your blogs index page. (default = '') 49# per_page: Posts displayed per page. (0 = disable pagination) 50# order_by: Posts order. (Order by date descending by default) 51index_generator: 52 path: '' # 主页所在路径,默认为'' 53 per_page: 10 # 主页的索引页包含文章数量,如未定义,则采用根目录下的`per_page`值 54 order_by: -date # 文章(Post类型)排序属性,`-`为降序 55 56# Category & Tag 57default_category: uncategorized # 对文档的默认分类 58category_map: # 对文档中的分类字段进行映射。建立分类文件夹时采用映射后的字符串 59tag_map: # 对文档中的标签字段进行映射。建立标签文件夹时采用映射后的字符串 60 61# Date / Time format 62## Hexo uses Moment.js to parse and display date 63## You can customize the date format as defined in 64## http://momentjs.com/docs/#/displaying/format/ 65date_format: YYYY-MM-DD # 日期格式 66time_format: HH:mm:ss # 时间格式 67 68# Pagination 69## Set per_page to 0 to disable pagination 70per_page: 10 # 主页/分类/标签/存档等类型索引页包含文章数量 71pagination_dir: page # 分页所在文件夹 72 73# Extensions # 扩展。放置插件和主题 74## Plugins: https://hexo.io/plugins/ 75## Themes: https://hexo.io/themes/ 76theme: landscape # 默认主题landscape 77 78# Deployment 79## Docs: https://hexo.io/docs/deployment.html 80deploy: # 定义部署 81 type:
