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

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
Forbes - Security
Forbes - Security
MongoDB | Blog
MongoDB | Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
量子位
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
腾讯CDC
P
Proofpoint News Feed
S
Schneier on Security
S
Secure Thoughts
V
Visual Studio Blog
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Privacy International News Feed
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
T
Threatpost
小众软件
小众软件
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
T
Tailwind CSS Blog
I
Intezer
C
CERT Recently Published Vulnerability Notes
U
Unit 42
V
V2EX
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
O
OpenAI News
Project Zero
Project Zero
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
博客园 - 叶小钗
S
Securelist
A
Arctic Wolf
The Cloudflare Blog
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
博客园 - Franky

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