Hexo Icarus 主题配置基础

Hexo Icarus 主题配置基础

Icarus 是一种非常简洁的 Hexo 主题,同时也安装了如评论和分享等很多可选的增强功能,使用起来非常方便好用。本篇文章主要介绍一下 Icarus 主题的配置基础。详细可以查看官方在线文档

Icarus 页面介绍

Icarus 页面(包括可选控件和增强功能)主要包含以下部分:

  • Top navigation bar
  • Article display
  • Sidebar widgets
  • Comment, share and search plugin
  • Bottom page footer

每一个部分都可以进行个性化处理,绝大多数的设置都放在了 _config.yml 文件里。

Icarus 基础配置

导航栏配置

Icarus 主题默认为英文模式,即使将博客的 language 更改为 zh-CN 导航栏的字还是英文。如果要更改为中文,则在如下位置进行更改(如将 Home 更改为首页):

_config.yml
1
2
3
4
5
6
7
8
9
# Navigation bar link settings
navbar:
# Navigation bar menu links
menu:
Home: /
Archives: /archives
Categories: /categories
Tags: /tags
About: /about

导航栏左边有一个 LOGO,也可以进行更改,将图片命名为 og_image.png 然后放到 source/images 文件夹中替换掉原图片。

另外,导航栏右边有一个 github 的图标,可以更改如下位置中 url 实现点击图标跳转到你的 github 仓库:

_config.yml
1
2
3
4
5
# Navigation bar links to be shown on the right
links:
Download on GitHub:
icon: fab fa-github
url: 'https://github.com/...'

用户信息配置

用户信息在如下位置进行更改:

_config.yml
1
2
3
4
5
6
7
8
9
10
11
-
type: profile
position: left
author:
author_title:
location:
avatar: /images/avatar.png
gravatar:
avatar_rounded: false
follow_link: 'https://github.com/...'
social_links:

其中 follow 按钮可以链接到任何你想要的页面,如你的 github 首页。 social_links 也可以进行更改,如果想去掉则直接注释掉。

控件配置

控件的显示与否和显示位置在如下位置进行修改:

_config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
widgets:
-
type: category
position: left
-
type: tagcloud
position: left
-
type: recent_posts
position: right
-
type: archive
position: right
-
type: tag
position: right

每个小横杠下的内容表示一个控件,如果不想显示,可以直接注释掉,但要注意前面的横杠也要注释掉。另外,控件在文件中的顺序和在网页中的顺序是相同的。

文章配置

为文章添加一个 thumbnail

Icarus 文章可以选择是否添加一个 thumbnial,首先确认 _config.yml 文件里是否已允许 thumbnail 功能:

_config.yml
1
2
artical:
thumbnail: true

然后只需在文章顶部加上如下语句:

yourArticle.md
1
2
3
4
5
---
title: yourTitle
thumbnail: /gallery/thumbnails/yourImage.jpg
---
Post content...

为文章添加分类和标签

只需在文章顶部加上如下语句:

yourArticle.md
1
2
3
4
5
6
7
8
9
10
11
12
---
title: yourTitle
categories:
- cat1
- cat2
- ...
tags:
- tag1
- tag2
- ...
---
Post content...

应该注意的是 cat1cat2 的父类。

页脚配置

从前面的导航栏和简介栏我们已经知道可以添加图标链接,页脚处也是如此,默认设置下页脚右侧为图标链接,格式如下:

_config.yml
1
2
3
4
5
6
7
8
footer:
links:
'Creative Commons':
icon: fab fa-creative-commons
url: 'https://creativecommons.org/'
'Attribution 4.0 International':
icon: fab fa-creative-commons-by
url: 'https://creativecommons.org/licenses/by/4.0/'

Icarus 同样支持纯文字链接,格式如下:

_config.yml
1
2
3
4
footer:
links:
'Creative Commons': 'https://creativecommons.org/'
'Attribution 4.0 International': 'https://creativecommons.org/licenses/by/4.0/'



  my

Comentarios

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×