閱讀本篇以前,假定讀者已經有了Node.js
的基礎,如須要補充Node.js
知識的,請自行百度。html
Hexo
是在Node.js
框架下的一個項目,利用Node.js
提供的強大功能,完成從Markdown到靜態網頁的轉換。git
NexT是Hexo項目下的一個主題插件,提供可高度定製的頁面外觀。github
本文章對Hexo站點配置文件_config.yml
中的配置進行詳細的講解。hexo
Hexo版本爲3.8.0,版本不一樣可能有不一樣ide
# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site title: Hexo # 網站的標題,可能用在各類佈局的頁面中 subtitle: # 網站子標題 description: # 網站的描述性 keywords: # 網站的關鍵字 author: John Doe # 網站的做者 language: # 網站採用語言,要跟/theme/***/languages/**.yml下的文件名對應。 timezone: # 網站的時區 # URL ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url: http://yoursite.com # 網站的url,若是不在域名根目錄,應包含子目錄,且root要設置爲`/子目錄/` root: / # 網站的根目錄 permalink: :year/:month/:day/:title/ #文章永久連接的造成模版。每一篇文章都有惟一的url。 permalink_defaults: #文章永久連接中,各部分的默認值。 # Directory source_dir: source # 網站中源文件(好比Markdown啊什麼的所在的文件夾) public_dir: public # 生成的靜態網站的目錄 tag_dir: tags # 標籤頁所在的文件夾。 archive_dir: archives # 文檔頁所在的文件夾 category_dir: categories # 類別也所在的文件夾 code_dir: downloads/code # 代碼也所在的文件夾 i18n_dir: :lang # 國際語言所在的文件夾 skip_render: # 忽略文檔清單 # Writing 寫做 new_post_name: :title.md # 默認新建文檔名,`:title`爲變量,指文檔標題,也可用其餘變量 default_layout: post # 新建文檔的默認佈局 titlecase: false # 是否要把標題中的首字符大寫 external_link: true # 是否要在新開tab中打開外鏈 filename_case: 0 # 文件名是否小寫敏感 render_drafts: false # 是否渲染草稿 post_asset_folder: false # 是否啓用資源文件夾。如啓用,新建文檔同時創建同名的資源文件夾 relative_link: false # 是否把站內資源的連接改成站內相對連接。建議關閉。 future: true # 文檔中指定爲將來時間建立 highlight: enable: true # 是否開啓代碼高亮功能 line_number: true # 代碼塊中是否在前面加上行號 auto_detect: false # 是否自動檢測代碼塊的語言(好比xml、JavaScript、mermaid等) tab_replace: # 用什麼字符來代替tab(`\t`)字符。 # Home page setting # path: Root path for your blogs index page. (default = '') # per_page: Posts displayed per page. (0 = disable pagination) # order_by: Posts order. (Order by date descending by default) index_generator: path: '' # 主頁所在路徑,默認爲'' per_page: 10 # 主頁的索引頁包含文章數量,如未定義,則採用根目錄下的`per_page`值 order_by: -date # 文章(Post類型)排序屬性,`-`爲降序 # Category & Tag default_category: uncategorized # 對文檔的默認分類 category_map: # 對文檔中的分類字段進行映射。創建分類文件夾時採用映射後的字符串 tag_map: # 對文檔中的標籤字段進行映射。創建標籤文件夾時採用映射後的字符串 # Date / Time format ## Hexo uses Moment.js to parse and display date ## You can customize the date format as defined in ## http://momentjs.com/docs/#/displaying/format/ date_format: YYYY-MM-DD # 日期格式 time_format: HH:mm:ss # 時間格式 # Pagination ## Set per_page to 0 to disable pagination per_page: 10 # 主頁/分類/標籤/存檔等類型索引頁包含文章數量 pagination_dir: page # 分頁所在文件夾 # Extensions # 擴展。放置插件和主題 ## Plugins: https://hexo.io/plugins/ ## Themes: https://hexo.io/themes/ theme: landscape # 默認主題landscape # Deployment ## Docs: https://hexo.io/docs/deployment.html deploy: # 定義部署 type: