2020年第1次「居红乡」装修记录

本文最后更新于 2022年3月28日 晚上

站点_config.yml

设置网站标题、副标题、描述、作者

1
2
3
4
5
6
# Site
title: 居红乡
subtitle: 'rsreland.net'
description: '千年调,一旦空,惟有纸钱灰晚风吹送。'
keywords:
author: 居红乡

 

设置网站语言、时区

1
2
language: zh-CN
timezone: 'Asia/Shanghai'

 

设置网站地址、文章链接

1
2
3
4
# URL
url: http://rsreland.net
root: /
permalink: :year/:month:day:hour:minute/

 

设置主题

1
2
# Extensions
theme: next

 

设置将网站部署到github

1
2
3
4
5
# Deployment
deploy:
type: git
repo: https://github.com/rsreland/rsreland.github.io.git
branch: master

 

设置文章存储名称

1
2
# Writing
new_post_name: :year:month:day-:title.md # File name of new posts # 原始值::title.md

 

 

主题_config.yml

设置站点建立日期

1
since: 2014

 

设置主题布局

1
2
3
4
5
# Schemes
#scheme: Muse
#scheme: Mist
#scheme: Pisces
scheme: Gemini

 

设置菜单选项、及增加“关于”、“标签”、“分类”、“404”、“系列”、“感谢”分页

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
menu:
home: / || fa fa-home
about: /about/ || fa fa-user
tags: /tags/ || fa fa-tags
categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive
series: /series/ || fa fa-folder-open
thanks: /thanks/ || fa fa-handshake-o
#schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat

# Enable / Disable menu icons / item badges.
menu_settings:
icons: true
badges: false

说明:修改完菜单后,使用命令新建页面。方法参考下面地址。

地址1:http://theme-next.iissnan.com/theme-settings.html#tags-page

地址2:http://theme-next.iissnan.com/theme-settings.html#categories-page

地址3:http://theme-next.iissnan.com/theme-settings.html#volunteer-404

1
2
3
4
5
6
7
8
9
10
11
12
menu:
home: 首页
archives: 归档
categories: 分类
tags: 标签
about: 关于
search: 搜索
schedule: 日程表
sitemap: 站点地图
commonweal: 公益 404
thanks: 感谢
series: 系列

后续:需要翻译新加项,修改在 next 目录下 themes\next\languages\zh-CN.yml 文件。

 

设置侧边栏头像、及特效

1
2
3
4
5
6
7
avatar:
# Replace the default image and set the url here.
url: /images/qpgwx.png
# If true, the avatar will be dispalyed in circle.
rounded: true
# If true, the avatar will be rotated with the cursor.
rotated: true

备注:将头像图片放置到主题根目录下的 source\images 文件夹中。

 

设置标签外观

1
tag_icon: true

 

设置捐赠渠道

1
2
3
4
5
6
7
8
9
reward_settings:
# If true, reward will be displayed in every article by default.
enable: true
animation: false
comment: 捐赠一元,支持我们。

reward:
wechatpay: /images/wechatpay.jpg
alipay: /images/alipay.jpg

备注:将收款二维码图片放置到主题根目录下的 source\images 文件夹中。

 

设置阅读进程条

1
2
3
4
5
6
7
# Reading progress bar
reading_progress:
enable: true
# Available values: top | bottom
position: top
color: "#750714"
height: 5px

 

设置文章评论功能

1
2
# LiveRe comments system
livere_uid: MTAyMC80ODM5NC8yNDg4OA== # <your_uid>

 

设置访问统计功能

1
2
# CNZZ count
cnzz_siteid: 1258704390

 

设置文章末尾版权信息

1
2
3
4
5
creative_commons:
license: by-nc-sa
sidebar: false
post: true
language:

 

设置网站图标

1
2
3
4
5
6
7
favicon:
small: /images/jhx16.png
medium: /images/jhx32.png
apple_touch_icon: /images/jhx.png
safari_pinned_tab: /images/logo.svg
#android_manifest: /images/manifest.json
#ms_browserconfig: /images/browserconfig.xml

备注:需将图标放到 source/images 目录下。

 

 

插件功能

添加本地搜索

注意:本功能需要安装插件。

插件:hexo-generator-searchdb

地址:https://github.com/theme-next/hexo-generator-searchdb

说明:安装方式参考上述地址中的安装说明。主题设置文件中 local_search 代码。

1
2
3
4
5
6
7
8
9
10
11
local_search:
enable: true
# If auto, trigger search by changing input.
# If manual, trigger search by pressing enter key or search button.
trigger: auto
# Show top n results per article, show all results by setting to -1
top_n_per_article: 1
# Unescape html strings to the readable one.
unescape: false
# Preload the search data when the page loads.
preload: false

 

添加推荐文章功能

注意:本功能需要安装插件。

插件:hexo-related-popular-posts

地址:https://github.com/tea3/hexo-related-popular-posts

说明:安装方式参考上述地址中的安装说明。插件安装后,需修改主题设置文件。

1
2
3
4
5
6
7
8
9
10
11
12
# Related popular posts
# Dependencies: https://github.com/tea3/hexo-related-popular-posts
related_posts:
enable: true
title: 推荐文章 # Custom header, leave empty to use the default one
display_in_home: false
params:
maxCount: 5
#PPMixingRate: 0.0
#isDate: false
#isImage: false
#isExcerpt: false

 

 

修改代码

设置网站背景图片

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
body {
background-image: url("../images/background.jpg"); //手动设置背景图片
background-attachment: fixed; //手动设置背景图片固定
background-repeat: no-repeat; //手动设置背景图片不重复
background-position: top center; //手动设置背景图片由上居中
background-color: #c1abad; //手动设置背景颜色
// background: var(--body-bg-color); //增加背景图片后,需要把本行注释掉
color: var(--text-color);
font-family: $font-family-base;
font-size: $font-size-base;
line-height: $line-height-base;

+tablet-mobile() {
// Remove the padding of body when the sidebar is open.
padding-left: 0 !important;
padding-right: 0 !important;
}
}

说明:通过修改主题根目录下 source\css\_common\scaffolding\base.styl 文件,手动设置背景图片。

 

设置二级分类前符号

将,

1
{{ __('symbol.comma') }}

改成,

1
{{ __('>') }}

说明:通过修改主题根目录下 layout\_macro\post.njk 文件,手动设置一级分类与二级分类之间的分隔符。

 

其他辅助

搭建图库

地址:https://github.com

说明:本站利用 github desktop + github 搭建图库,本质上是搭建了一个只有图片的 github pages。

 

 


捐赠一元,支持我吧!  

注:捐赠时如在留言中注明网名或昵称,即可被列入到感谢名单中。否则,会以佚名身份列入名单。


2020年第1次「居红乡」装修记录
https://rsreland.net/blog/202001261738/
作者
百二一
发布于
2020年1月26日
许可协议