Skip to Content

Friendly Links

Effect

Configuration Tutorial

Execute the following command in the root directory of your Hexo project to create a links page.

$ hexo new page links

Then, open the Markdown file of this page ( source/links/index.md ), edit the Front Matter, add template: links, and you can create a Links page.

source/links/index.md
---
title: Links (Your custom title)
date: 2020-05-13 14:16:07
template: links
---

Modify the Configuration File

Add the Links page to the navbar.links navigation bar configuration item in the Redefine theme configuration file _config.redefine.yml.

_config.redefine.yml
navbar:
  links:
    Friends: # Customize the name
        icon: fa-solid fa-link # Icon
        path: /links/

(It can also be placed in the secondary menu)

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:

source/_data/links.yml
 
- links_category: 分类名
  has_thumbnail: 是否有预览图(true/false)
  list: 
  - name: 名字
    link: 链接
    description: 描述
    avatar: 头像
    thumbnail: 预览图(has_thumbnail 为 true 时才需要)
 

Example:

source/_data/links.yml
 
- 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:

source/links/index.md
---
title:
  '[object Object]': null
date:
  '[object Object]': null
---

Then please open the scaffolds/page.md file in the Hexo root directory.

Change:

scaffolds/page.md
---
title: { { title } }
date: { { date } }
---

to:

scaffolds/page.md
---
title: {{ title }}
date: {{ date }}
---

Then delete the links page you just created and execute the command again:

$ hexo new page links

to recreate it.

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

_config.redefine.yml
page_templates:
  friends_column: 3
TypeOptional ValuesDefault Value
Number2 | 33
Last updated on