主題優(yōu)化
主題配置介紹
我這里只講自己在使用的 yelle 主題腺占,你可以參考下衰伯,可能還有一些改動我后續(xù)會自己在慢慢改意鲸,但是大體基本也就這樣了怎顾。
從中我們也可以看出槐雾,對于主題來講蚜退,大部分可以配置的地方其實都是在這里的钻注,所以對于主題的使用者來講幅恋,懂這里很重要。
- 基本上主題的配置文件都是有內(nèi)容改淑翼,但是下面這幾點我覺得特別重要:
-
duoshuo
,如果你是打算采用多說評論系統(tǒng)的話遭京,你需要設(shè)置這里哪雕,但是我個人對多說沒好印象 -
youyan
,有言也是國內(nèi)實用比較多的評論系統(tǒng)之一堡僻,個人感覺相對比較穩(wěn)定 -
open_in_new
苦始,我個人覺得這個東西就應(yīng)該是 true陌选,不是用新標簽的都是壞人 -
baidu_tongji
咨油,我個人使用的是百度統(tǒng)計赚爵,具體百度統(tǒng)計的使用可以查看百度統(tǒng)計官網(wǎng):http://#baidu.com
我的 yelle 主題配置
# >>> Basic Setup | 基礎(chǔ)設(shè)置 <<<
# Header | 主菜單
## About Page: `hexo new page about`
## Tags Cloud Page: `hexo new page tags`
menu:
主頁: /
關(guān)于我: /about/
標簽云: /tags/
所有文章: /archives/
IntelliJ IDEA: /tags/IntelliJ IDEA
# Link to your avatar | 填寫頭像地址
avatar: /img/avatar.png
# Small icon of Your site | 站點小圖標地址
favicon: /favicon.png
# If your site' url is 'http://yoursite.com/blog', set root_url as '/blog/'
# 網(wǎng)站若存放在子目錄冀膝,請按上面格式填寫
# https://hexo.io/docs/configuration.html#URL
root_url:
# Social info. Bar | 社交信息展示
## Keep "mailto:" in Email | 設(shè)置 Email 時保留 "mailto:"
## Encrypt email 加密郵件地址 http://ctrlq.org/encode/
## RSS requires a plugin to take effect | 使用 RSS 需先安裝對應(yīng)插件
## https://github.com/hexojs/hexo-generator-feed
subnav:
Email: "mailto:judas.n@qq.com"
#新浪微博: "sina weibo"
GitHub: "https://github.com/judasn/IntelliJ-IDEA-Tutorial"
RSS: "/atom.xml"
#V2EX: "#"
#知乎: "zhihu"
#豆瓣: "douban"
#簡書: "jianshu"
#SegmentFault: ""
#網(wǎng)易云音樂: "netease"
#蝦米音樂: "xiami"
#Facebook: "#"
#Google: "#"
#Twitter: "#"
#LinkedIn: "#"
#QQ: "#"
#微信: "Wechat"
#PayPal: "#"
#StackOverflow: "#"
#Instagram: "#"
#Flickr: "#"
#reddit: ""
#Medium: ""
#TiddlyWiki: ""
#Tumblr: ""
#_500px: ""
# >>> Conments 評論系統(tǒng) <<<
# Chose ONE as your comment system and keep others disable.
# 選一個作為網(wǎng)站評論系統(tǒng)酥夭,其他保持禁用熬北。
disqus:
#on: true
shortname:
# https://help.disqus.com/customer/en/portal/articles/466208-what-s-a-shortname-
# It is unnecessary to enable disqus here if
# you have set "disqus_shortname" in your site's "_config.yml"
duoshuo:
#on: true
domain:
# 是否開啟多說評論起胰,http://duoshuo.com/create-site/
# 使用上面網(wǎng)址登陸你的多說效五,然后創(chuàng)建站點火俄,在 domain 中填入你設(shè)定的域名前半部分
# http://<要填的部分>.duoshuo.com (domain只填上<>里的內(nèi)容适瓦,不要填整個網(wǎng)址)
youyan:
on: true
id: 1738968
# 是否開啟友言評論玻熙,http://www.uyan.cc/index.php
# id 中填寫你的友言用戶數(shù)字ID嗦随,注冊后進入后臺管理即可查看
# 友言服務(wù)在 Web 環(huán)境下運行,普通本地環(huán)境無法查看,請部署后在線上測試蜻直。
# >>> Style Customisation 樣式自定義 <<<
# Background | 背景
## "5": show images form bg-1.jpg to bg-5.jpg in `/yelee/source/background/`
## "5": 顯示`/yelee/source/background/`文件夾中 bg-1.jpg 到 bg-5.jpg 這5張圖片
## "0": white-gray background | 淳樸灰白背景
background_image: 0
highlight_style:
on: true
inline_code: 3 # Value: 0 - 9 可選,3還不錯
code_block: 2 # Value: 0 - 4
# Set inline_code to style highlight text
# Chose a highlight theme for code block
# 通過 inline_code 切換內(nèi)置文本高亮樣式
# 通過 code_block 切換內(nèi)置代碼高亮配色主題
blockquote_style:
on: true
blockquote: 3 # Value: 0 - 7 可選
# 自定義文章「引用部分」的樣式
# 左邊欄寬度 px
left_col_width: 330
# Copyright info. of post | 文末版權(quán)信息
copyright: true
# Table of contents | 文章目錄
toc: true
# 目錄中標題不換行
# Keep TOC title on the same line |
toc_nowrap: true
# 自定義"閱讀全文"鏈接按鈕的顯示文字
# Customize the text on excerpt link
excerpt_link: more
# 是否顯示邊欄中的搜索框(僅樣式,未添加搜索功能)
# Search Box in left column
search_box: false
# 是否開啟主頁及加載頭像時的動畫效果
# Animation in Homepage and Loading avatar
animate: true
# Load jQuery UI to style tooltips
# 工具提示框樣式美化
jquery_ui: false
# >>> Small features | 小功能設(shè)置 <<<
# 是否開啟邊欄多標簽切換
# Birdhouse button in left column
tagcloud: true
# Blogroll, Link exchange | 友情鏈接
friends:
YouMeek: http://www.YouMeek.com
YouMeek導(dǎo)航: http://i.YouMeek.com
GitHub: https://github.com/
IntelliJ IDEA: http://www.jetbrains.com/idea/
#friends: false
#是否開啟“關(guān)于我”。
aboutme: 此地只專注于技術(shù)
#aboutme: true
# 是否在新窗口打開鏈接
# Open ALL link in a new tab
open_in_new: true
# Customize feed link 自定義訂閱地址
rss: /atom.xml
# >>> Vendors | 第三方工具 & 服務(wù) <<<
# images viewer | 圖片瀏覽器
## http://www.fancyapps.com/fancybox/
fancybox: true
# Display Math(LaTeX, MathML...) | 數(shù)學(xué)公式支持
## https://www.mathjax.org/
mathjax: false
# Socail Share | 是否開啟分享
share: true
# 百度、谷歌站長驗證瓶佳。填寫 HTML 標簽 content
# Site Verification for Google and Baidu. HTML label content.
baidu_site:
google_site:
# Fill in Google Analytics tracking ID, #e.g. UA-XXXXX-X
google_analytics:
# 百度統(tǒng)計 http://sitecenter.baidu.com/sc-web/
# 查看代碼,填入 //#/hm.js? 之后的內(nèi)容
baidu_tongji: b68dade9d355a0b3d875d0ffbbe1f212
# 不蒜子網(wǎng)站計數(shù)設(shè)置
# http://ibruce.info/2015/04/04/busuanzi/
visit_counter:
on: true
site_visit: 本站到訪數(shù)
page_visit: 本頁閱讀量
# GitHub Repo Widget
# https://github.com/hustcc/GitHub-Repo-Widget.js
github_widget: false
常用頁面添加
404厚脉、關(guān)于我、標簽頁
- 還是以上一篇文章我們講解的項目根目錄上:E:\git_work_space\hexo中捆,在該目錄啟動 Git Bash:
- 新增一個 404 頁面:
hexo new page 404
- 新增一個 about 頁面:
hexo new page about
- 新增一個 tag 標簽云頁面:
hexo new page tags
- 新增一個 robot.txt 文件,把該文件放在:E:\git_work_space\hexo\source 目錄下蟋滴,如果你沒有該文件可以到我的項目上找:https://github.com/judasn/judasn.github.io
- robot 文件內(nèi)容:
User-Agent: *
Allow: /
Disallow: /background
Disallow: /css
Disallow: /fancybox
Disallow: /font-awesome
Disallow: /img
Disallow: /js
Sitemap: http://code.youmeek.com/sitemap.xml
Sitemap: http://code.youmeek.com/baidusitemap.xml
插件推薦
插件的基本使用命令
- 安裝插件:
npm install 插件名 --save
- 卸載插件:
npm uninstall 插件名
- 更新插件和博客框架(需要在 E:\git_work_space\hexo 目錄下):
npm update
- 它實質(zhì)上是通過項目根目錄下 package.json 文件更新各大組件
必備插件
- 支持RSS:
npm install hexo-generator-feed --save
- 生成站點地圖:
npm install hexo-generator-sitemap --save
- 生成百度站點地圖:
npm install hexo-generator-baidu-sitemap --save
- HTML 壓縮:
npm install hexo-html-minifier --save
- JavaScript 壓縮:
npm install hexo-uglify --save
- CSS 壓縮插件:
npm install hexo-clean-css --save
- SEO優(yōu)化:
npm install hexo-generator-seo-friendly-sitemap --save
結(jié)束語
- 真心希望這是 Hexo 最后一篇球散,因為我們只是要安心寫東西而已蕉堰,不需要太多折騰冰寻。