前文手把手教從零開始在GitHub上使用Hexo搭建博客教程(一)-附GitHub註冊及配置介紹了github註冊、git相關設置以及hexo基本操做。html
本文主要介紹一下hexo的經常使用參數設置。git
網站配置文件是在根目錄下的**_config.yml文件,是yaml格式的。
全部的配置項後面的冒號(:)與值之間要有一個空格。**
官方配置文件說明github
# Hexo Configuration ## Docs: https://hexo.io/docs/configuration.html ## Source: https://github.com/hexojs/hexo/ # Site 網站信息 title: 網站標題 subtitle: 網站副標題 description: 網站描述 author: 網站做者名字 language: #網站語言,默認是英語(en) timezone: #網站時區 # URL 網站設置 ## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/' url: seayxu.github.io #網站的地址 root: / #網站的根目錄,若是是子文件夾下,則填寫子文件夾路徑 permalink: :year/:month/:day/:title/ #文章連接地址格式 permalink_defaults: # Directory 目錄設置 source_dir: source #資源文件夾,默認是source public_dir: public #公共文件夾,默認是public tag_dir: tags #標籤文件夾,默認是tags archive_dir: archives #檔案文件夾,默認是archives category_dir: categories #分類文件夾,默認是categories code_dir: downloads/code #代碼文件夾,默認是downloads/code i18n_dir: :lang #國際化文件夾,默認跟language相同 skip_render: [] #不須要渲染的文件夾或文件夾,放在[]中 # Writing 文章寫做選項 new_post_name: :title.md # File name of new posts default_layout: post #默認佈局模板 titlecase: false # Transform title into titlecase external_link: true # Open external links in new 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 tab_replace: # 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 #每頁顯示數量,設置爲0表示不啓用分頁 pagination_dir: page #分頁文件夾名稱 # Extensions 擴展 ## Plugins: https://hexo.io/plugins/ #插件 plugins: hexo-generator-feed #RSS訂閱插件 hexo-generator-sitemap #sitemap插件 ## Themes: https://hexo.io/themes/ #主題 theme: landscape #主體名稱 # Deployment 部署 ## Docs: https://hexo.io/docs/deployment.html deploy: type: git repo: git@github.com:SeayXu/seayxu.github.io.git #github倉庫地址 branch: master # github分支
若是是擴展插件,要在**_config.yml配置文件中添加插件信息,是plugins**配置項。
好比下面的兩個插件:npm
plugins: hexo-generator-feed #RSS訂閱插件 hexo-generator-sitemap #sitemap插件
而後,安裝插件,後面要加上--save
,表示依賴項。hexo
npm install hexo-generator-feed --save
添加配置信息佈局
#sitemap sitemap: path: sitemap.xml
npm install hexo-generator-sitemap --save
添加配置信息:post
#feed atom: type: atom path: atom.xml limit: 20
能夠在主題配置文件中添加相關配置,能夠在頁面上顯示。
好比,添加連接信息網站
links: Feed: /atom.xml SiteMap: /sitemap.xml
npm install hexo-deployer-git --save
內置插件搜索引擎
在Hexo 3.0中如下插件是內置的:atom
hexo-server
更多插件能夠查閱官方插件頁
默認的主題是landscape
若是不喜歡,能夠在網上找到本身喜歡的主題,做爲本身的主題使用。
官方主題地址:傳送門
好比我目前使用的是基於jacman修改的。
git clone https://github.com/wuchong/jacman themes/jacman
theme: landscape
爲theme: jacman
;
【Hexo博客交流羣】
羣號:582271078