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

推荐订阅源

Project Zero
Project Zero
月光博客
月光博客
Y
Y Combinator Blog
T
The Blog of Author Tim Ferriss
O
OpenAI News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Know Your Adversary
Know Your Adversary
Last Week in AI
Last Week in AI
S
Securelist
Engineering at Meta
Engineering at Meta
博客园 - 司徒正美
P
Privacy & Cybersecurity Law Blog
T
Tailwind CSS Blog
F
Fortinet All Blogs
博客园 - 三生石上(FineUI控件)
Scott Helme
Scott Helme
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
C
Cisco Blogs
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
小众软件
小众软件
U
Unit 42
Microsoft Azure Blog
Microsoft Azure Blog
Hacker News: Ask HN
Hacker News: Ask HN
Hugging Face - Blog
Hugging Face - Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
SecWiki News
SecWiki News
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
Lohrmann on Cybersecurity
IT之家
IT之家
Security Archives - TechRepublic
Security Archives - TechRepublic
I
InfoQ
S
Security @ Cisco Blogs
Webroot Blog
Webroot Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
F
Full Disclosure
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The GitHub Blog
The GitHub Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
人人都是产品经理
人人都是产品经理
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research

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