惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

G
Google Developers Blog
Spread Privacy
Spread Privacy
V
Visual Studio Blog
爱范儿
爱范儿
Apple Machine Learning Research
Apple Machine Learning Research
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
Google DeepMind News
Google DeepMind News
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
V2EX
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
B
Blog RSS Feed
博客园 - 【当耐特】
有赞技术团队
有赞技术团队
The Register - Security
The Register - Security
Latest news
Latest news
The Cloudflare Blog
Project Zero
Project Zero
月光博客
月光博客
U
Unit 42
Vercel News
Vercel News
Attack and Defense Labs
Attack and Defense Labs
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
F
Full Disclosure
Schneier on Security
Schneier on Security
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
博客园 - 叶小钗
腾讯CDC
博客园 - 三生石上(FineUI控件)
T
The Blog of Author Tim Ferriss
D
Darknet – Hacking Tools, Hacker News & Cyber Security
博客园 - Franky
S
Security Affairs
Hacker News: Ask HN
Hacker News: Ask HN
Security Latest
Security Latest
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
MongoDB | Blog
MongoDB | Blog
D
DataBreaches.Net
SecWiki News
SecWiki News
Recorded Future
Recorded Future
NISL@THU
NISL@THU
Hacker News - Newest:
Hacker News - Newest: "LLM"
Cloudbric
Cloudbric

Butterfly

Butterfly 5.6 Release Notes Butterfly 5.5 Release Notes Butterfly 5.4 Release Notes Butterfly 5.3 Release Notes Butterfly 5.2 Release Notes Butterfly 5.1 Release Notes Butterfly 5.0 Release Notes Butterfly 4.13 Release Notes Butterfly 4.12 Release Notes Butterfly 4.11 Release Notes Butterfly 4.10 Release Notes Butterfly Changelog Butterfly document - Advanced Tutorial Butterfly document - Q&A Butterfly document - Tag Plugins Butterfly document - Theme Configuration Butterfly document - Theme Pages Butterfly document - Get Started When Setting top_img to false Customize code coloring no cover Tag Plugins Markdown Style test
Custom Sidebar
Jerry · 2020-12-30 · via Butterfly

Applicable to >= 3.8.0

The sidebar now supports customization, allowing you to add your favorite widgets. You can add your own widgets or sort existing ones (the Blog Data and Announcement widgets are fixed, but others can be sorted).

You only need to configure the sort_order. (It uses the order property of the Flex layout. For specific details, you can refer to the Mozilla documentation. In simple terms, use numbers to specify the sorting order. If not configured, the default value is 0. The smaller the number, the higher the sorting order.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
aside:
...
card_recent_post:
sort_order:
card_categories:
sort_order:
card_tags:
sort_order:
card_archives:
sort_order:
card_webinfo:
sort_order:

newest_comments:
enable: true
sort_order:

If you want to add your own content to the sidebar, you can customize it.

Create widget.yml

Create a file widget.yml in the source/_data directory of your Hexo blog (if the _data folder doesn't exist, create it).

Format

1
2
3
4
5
6
7
8
9
10
11
12
13
14
top:
- class_name:
id_name:
name:
icon:
html:

bottom:
- class_name:
id_name:
name:
icon:
order:
html:

Parameter Explanation

top: The created widget will appear in the non-sticky area (visible on all pages).

bottom: The created widget will appear in the sticky area (except for the article page).

ParameterExplanation
class_nameThe parent class name of the created widget (optional)
id_nameThe parent id name of the created widget (optional)
nameThe title of the created widget
iconThe icon of the created widget
orderThe sorting order of the created widget (optional)
htmlThe relevant code of the created widget

image-20201230223506507

The generated code will be:

1
2
3
4
5
6
7
8
9
<div class="card-widget Your_written_class_name" id="Your_written_id_name" style="order: Your_written_order">
<div class="item-headline">
<i class="Your_written_icon"></i>
<span>Your_written_name</span>
</div>
<div class="item-content">
Your_written_html
</div>
</div>

If you need to make UI adjustments to the added widgets, please add CSS to the inject.

Example

Let's take the Visitor Map as an example:

  1. Get the HTML code for the visitor map:

    1
    <script type="text/javascript" id="clstr_globe" src="//clustrmaps.com/globe.js?d=5V2tOKp8qAdRM-i8eu7ETTO9ugt5uKbbG-U7Yj8uMl8"></script>
  2. Create widget.yml:

    1
    2
    3
    4
    5
    6
    7
    bottom:
    - class_name: user-map
    id_name: user-map
    name: Visitor Map
    icon: fas fa-heartbeat
    order:
    html: '<script type="text/javascript" id="clstr_globe" src="//clustrmaps.com/globe.js?d=5V2tOKp8qAdRM-i8eu7ETTO9ugt5uKbbG-U7Yj8uMl8"></script>'
  3. Run Hexo

    image-20201230224442356

Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.

Buy Me a Coffee

  • Wechat

    Wechat

  • Alipay

    Alipay

  • Stripe

    Stripe

avatar

Jerry

A Simple and Card UI Design theme for Hexo

GitHub