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

推荐订阅源

L
LINUX DO - 最新话题
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
PCI Perspectives
PCI Perspectives
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
H
Heimdal Security Blog
S
Security @ Cisco Blogs
N
News | PayPal Newsroom
J
Java Code Geeks
罗磊的独立博客
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
V
V2EX
WordPress大学
WordPress大学
Google Online Security Blog
Google Online Security Blog
N
News and Events Feed by Topic
www.infosecurity-magazine.com
www.infosecurity-magazine.com
月光博客
月光博客
AI
AI
小众软件
小众软件
The GitHub Blog
The GitHub Blog
MongoDB | Blog
MongoDB | Blog
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
美团技术团队
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
S
Schneier on Security
博客园 - 三生石上(FineUI控件)
F
Full Disclosure
B
Blog RSS Feed
Forbes - Security
Forbes - Security
S
SegmentFault 最新的问题
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
云风的 BLOG
云风的 BLOG
Jina AI
Jina AI
Cisco Talos Blog
Cisco Talos Blog
U
Unit 42
Project Zero
Project Zero
H
Hacker News: Front Page
Y
Y Combinator Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
The Cloudflare Blog
大猫的无限游戏
大猫的无限游戏
S
Secure Thoughts
The Hacker News
The Hacker News
Microsoft Azure Blog
Microsoft Azure Blog

Butterfly

Butterfly 5.6 更新日誌 香港銀行開戶推薦 (附邀請碼) Butterfly 5.5 更新日誌 Butterfly 5.4 更新日誌 Butterfly 5.3 更新日誌 Butterfly 5.2 更新日誌 Butterfly 5.1 更新日誌 Butterfly 5.0 更新日誌 Butterfly 4.13 更新日誌 Butterfly 4.12 更新日誌 Butterfly 4.11 更新日誌 Butterfly 4.10 更新日誌 當設置 top_img 為 false 時 Butterfly添加全局吸底Aplayer教程 自定義代碼配色 Butterfly 打賞 Butterfly 更新日誌 Butterfly 文檔(六) 進階教程 Butterfly 文檔(五) 主題問答 Butterfly 文檔(四) 標簽外挂 Butterfly 文檔(三) 主題配置 Butterfly 文檔(二) 主題頁面 Butterfly 文檔(一) 快速開始 沒有封面 標籤外掛(Tag Plugins) Markdown Style test
自定義側邊欄
Jerry · 2020-12-30 · via Butterfly

適用於 >= 3.8.0

側邊欄現在支持自定義了,可以添加自己喜歡的 widget。

可添加自己的 widget,也可以對現有的 widget 進行排序(博客資料公告這兩個固定,其它的能排序)

只需要配置 sort_order就行。(使用了 Flex 佈局的 order 屬性,具體可查看 mozilla 文檔。簡單來講,就是配置數字來實現排序,如果不配置,則默認為 0。數字越小,排序越靠前。

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:

如果你想添加自己的內容到側邊欄去,你可以自定義。

創建 widget.yml

在 Hexo 博客目錄中的source/_data(如果沒有 _data 文件夾,請自行創建),創建一個文件 widget.yml

格式

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:

參數詳解

top: 創建的 widget 會出現在非 sticky 區域(即所有頁面都會顯示)

bottom: 創建的 widget 會出現在 sticky 區域(除了文章頁都會顯示)

參數解釋
class_name所創建的 widget 父類 class 名 (可選)
id_name所創建的 widget 父類 id 名(可選)
name所創建的 widget 標題
icon所創建的 widget 圖標
order所創建的 widget 排序 (可選)
html所創建的 widget 相關代碼

adside-diy-parameter.png

生成的 代碼 為

1
2
3
4
5
6
7
<div class="card-widget 所寫的 class_name" id="所寫的 id_name" style="order: 所寫的 order">
<div class="item-headline">
<i class="所寫的 icon"></i>
<span>所寫的 name</span>
</div>
<div class="item-content">所寫的 html</div>
</div>

如果你需要對添加的 widget 進行 UI 調整,請自行添加 css 到 inject 去。

例子

訪客地圖 為例子

  1. 獲取訪客地圖的 html 代碼

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

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

    aside-diy-sample.png

版權聲明: 除特別聲明外,本博客所有文章均採用CC BY-NC-SA 4.0 授權協議。轉載請註明出處:Butterfly

avatar

Jerry

A Simple and Card UI Design theme for Hexo

主題 GitHub