Friendly Links
Effect
Configuration Tutorial
Create a Links Page
Execute the following command in the root directory of your Hexo project to automatically create a links page.
$ hexo new page links
Note:
The style of the links is matched based on title: links
by default.
If you need to customize the title of the page, you need to add type: links
in the Front Matter to customize the page title.
Example 1:
---
title: Links
date: 2020-05-13 14:16:07
---
Example 2:
---
title: 自定义标题
date: 2020-05-13 14:16:07
type: links
---
Modify the Configuration File
Enable links
in the navbar
configuration item of the Redefine theme configuration file _config.redefine.yml
.
navbar:
links:
Friends: #取名随意
icon: fa-solid fa-link #图标
path: /links/
(It can also be placed in the secondary menu)
Create a Links Storage File
Add a _data
folder in the source
folder of your Hexo project.
If you already have a _data
folder, ignore this step.
Create a links.yml
file in the _data
folder.
Add your links in the links.yml
file in the following format.
Format:
- links_category: 分类名
has_thumbnail: 是否有预览图(true/false)
list:
- name: 名字
link: 链接
description: 描述
avatar: 头像
thumbnail: 预览图(has_thumbnail 为 true 时才需要)
- ......
Example:
- links_category: Elites
has_thumbnail: true
list:
- name: EvanNotFound's Blog
link: https://ohevan.com
description: 用香港记者的速度更新文章
avatar: https://evan.beee.top/avatar.png
thumbnail: https://img1.imgtp.com/2023/06/19/Jegvz84P.png # has_thumbnail 为 true 时才需要
- links_category: Normal
has_thumbnail: false
list:
- name: Example Site
link: https://example.com
description: Example Site Description
avatar: https://www.youtube.com/watch?v=dQw4w9WgXcQ
- name: Example Site 2
link: https://example.com
description: Example Site Description
avatar: https://www.youtube.com/watch?v=dQw4w9WgXcQ
- ......
Note:
If after creating it, you find that the Front Matter of this page is in this format:
---
title:
'[object Object]': null
date:
'[object Object]': null
---
Then please open the scaffolds/page.md
file in the Hexo root directory.
Change:
---
title: { { title } }
date: { { date } }
---
to:
---
title: {{ title }}
date: {{ date }}
---
Then delete the links page you just created and execute the command again:
$ hexo new page links
to recreate it.
Change the Number of Links Columns
Modify friends_column
in the page_templates
configuration item of the Redefine theme configuration file _config.redefine.yml
.
Configuration item name: page_templates.friends_column
page_templates:
friends_column: 3
Type | Optional Values | Default Value |
---|---|---|
Number | 2 | 3 | 3 |