本文介紹hexo next主題的使用和一些好用的配置,同時(shí)記錄自己的配置過程
本人的博客主目錄為/blog,以下博客配置文件指/blog/_config.yml 主題配置文件指 ~/blog/themes/next/_config.yml
設(shè)置語言以及網(wǎng)站基本信息
# Site
title: 徐先生的小窩 #網(wǎng)站名稱
subtitle: 記錄自己的成長(zhǎng) #子名稱
description: 特立獨(dú)行的普通人 #網(wǎng)站簡(jiǎn)介
keywords: free #關(guān)鍵字
author: sand #作者名稱
language: zh-CN #語言 簡(jiǎn)體漢語
timezone: Asia/Shanghai #時(shí)區(qū)
安裝使用next主題
進(jìn)入博客目錄,然后從Github克隆到themes/next
$ cd blog
$ git clone https://github.com/theme-next/hexo-theme-next themes/next
編輯主配置文件blog/_config.yml選擇next主題
注釋掉原來的theme,新添加'theme: next'
配置圖
現(xiàn)在就已經(jīng)切換為next主題了
選擇Scheme
Scheme 是next 提供的一種特性,借助Scheme,next為你提供多種不同的外觀。而且?guī)缀跛械呐渲枚伎梢栽赟cheme之間公用。
# Schemes
#scheme: Muse
scheme: Mist
#scheme: Pisces
#scheme: Gemini
設(shè)置菜單
在主題目錄下的配置文件中menu配置
menu:
home: / || home
about: /about/ || user
tags: /tags/ || tags
categories: /categories/ || th
archives: /archives/ || archive
# schedule: /schedule/ || calendar
#music: /music/ || music
#sitemap: /sitemap.xml || sitemap
#commonweal: /404/ || heartbeat
設(shè)置tags 和categories時(shí)需要新生成page
在博客主目錄下執(zhí)行
cd ~/blog
hexo new page tags #生成標(biāo)簽頁
hexo new page categories #生成分類頁面
*為 ~/blog/source/tags/index.md 和~/blogsource/categories/index.md 添加type 類型 *
***分別添加 type: tags 和 type: categories ***
type_tags
type_categories
添加友情鏈接
在主題配置文件(Blog\themes\next_config.yml)中打開links 開關(guān)即可
# Blog rolls
links_icon: link
links_title: 友情鏈接
links_layout: block
#links_layout: inline
links:
#Title: http://example.com/
設(shè)置頭像
編輯主題配置文件片部,修改字段 avatar, 值修改成頭像的連接地址。
地址 | 值 |
---|---|
完整的互聯(lián)網(wǎng)URI | http://example.com/avatar.png |
站點(diǎn)內(nèi)地址 | 將頭像放至source/images/ 目錄下 配置為: avatat: /images/avatar.png |
百度統(tǒng)計(jì)
- 登錄百度統(tǒng)計(jì)霜定,定位到站點(diǎn)的代碼獲取頁面档悠。
- 復(fù)制 hm.src = "https://#/hm.js? 后面的那串統(tǒng)計(jì)腳本id.
- 編輯主題配置文件,修改 baidu_analytics 字段望浩,將其值設(shè)置為剛剛復(fù)制的id.
修改文章底部的帶# 號(hào)的標(biāo)簽
效果圖
效果圖
實(shí)現(xiàn)方法
修改模板 ~/blog/themes/next/layout/_macro/post.swig辖所,搜索 rel="tag">\#
將 #
換成 <i class="fa fa-tag"></i>
最后歡迎大家訪問我的博客: 徐先生的小窩