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

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
NISL@THU
NISL@THU
S
Securelist
O
OpenAI News
S
Security Affairs
Cyberwarzone
Cyberwarzone
T
Threatpost
Simon Willison's Weblog
Simon Willison's Weblog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 最新话题
C
Cisco Blogs
PCI Perspectives
PCI Perspectives
SecWiki News
SecWiki News
S
Secure Thoughts
GbyAI
GbyAI
I
Intezer
AWS News Blog
AWS News Blog
F
Fortinet All Blogs
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
Google Online Security Blog
Google Online Security Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
A
About on SuperTechFans
S
Schneier on Security
P
Proofpoint News Feed
雷峰网
雷峰网
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
H
Heimdal Security Blog
Microsoft Security Blog
Microsoft Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs
V
V2EX
L
Lohrmann on Cybersecurity
Security Latest
Security Latest
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
H
Hacker News: Front Page
Cisco Talos Blog
Cisco Talos Blog
Webroot Blog
Webroot Blog
T
Tenable Blog
MyScale Blog
MyScale Blog
博客园 - 司徒正美
S
SegmentFault 最新的问题
Y
Y Combinator Blog
腾讯CDC
Hacker News: Ask HN
Hacker News: Ask HN
M
MIT News - Artificial intelligence
G
GRAHAM CLULEY

Sun Boy's Blog

五一浪荡 春色怡人 冬日印象 蜜月之旅 2025 回忆上学三两事(二) 秋尾闲游 我们所需要的婚礼 关于校园恋爱的思考 回忆上学三两事(一) 问答分享:有个妹妹是种什么体验 月全食人生首拍 尼康新手人像初拍 基于腾讯云COS自动生成相册 回忆找工作三两事 更换busuanzi统计服务记录 Github Actions与EdgeOne自动化刷新 第一次拍月亮记录 源站域名和回源HOST头理解及个人实践
文章页面默认头图透明调整记录
Sun Boy · 2025-08-23 · via Sun Boy's Blog

写前哔哔

由于我的博客是背景一图流,使用头图的话会很影响整体美观,官方文档的方法是在每篇文章Post Front-matter的处添加top_img: transparent配置选项来单独实现,但对我来说每次都要配置很是繁琐。

正文开始

  • 方法一:根据店长关于背景一图流的教程中有提到过,可以在custom.css中添加如下代码解决:
1
2
3
#page-header{
background: transparent!important;
}

它的作用是选择页面中 ID 为 page-header 的元素,将其背景设置为透明(transparent),并且通过 !important 声明强制提高该样式的优先级,确保它会覆盖其他可能存在的、针对该元素背景的样式规则。

  • 方法二:直接从源码入手,打开[Blogroot]\themes\butterfly\layout\includes\header\index.pug文件,将原来的 top_img = page.top_img || page.cover || theme.default_top_img 改为 top_img = page.top_img ? page.top_img : 'transparent'
1
2
3
4
if !theme.disable_top_img && page.top_img !== false
case globalPageType
when 'post'
- top_img = page.top_img ? page.top_img : 'transparent'

意思是:仅当明确设置 top_img 时,使用指定图片;不设置时,默认赋值为 'transparent'(透明标识)

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 Sun Boy's Blog