favicon-generator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseComponents: Favicon
组件:Favicon
Guides favicon and app icon implementation for brand consistency across browser tabs, bookmarks, mobile home screens, and Google Search results. Favicons help users identify sites; missing or incorrect icons hurt trust.
When invoking: On first use, if helpful, open with 1-2 sentences on what this skill covers and why it matters, then provide the main output. On subsequent use or when the user asks to skip, go directly to the main output.
本指南用于指导 favicon 和应用图标的实现,确保在浏览器标签页、书签、移动设备主屏幕以及 Google 搜索结果 中保持品牌一致性。Favicon 可帮助用户快速识别站点,缺失或错误的图标会损害用户信任。
调用规则:首次使用时,如果有帮助,可以先用1-2句话介绍本技能涵盖的内容及其重要性,再提供核心输出。后续调用或用户要求跳过介绍时,直接输出核心内容即可。
Initial Assessment
初始评估
Check for product marketing context first: If or exists, read it for brand and visual identity.
.claude/product-marketing-context.md.cursor/product-marketing-context.mdIdentify:
- Tech stack: Next.js, WordPress, static HTML, etc.
- PWA: Is the site a PWA or planning to be?
- Existing assets: Logo, icon files
优先检查产品营销上下文:如果存在 或 文件,先读取其中的品牌和视觉标识相关信息。
.claude/product-marketing-context.md.cursor/product-marketing-context.md确认以下信息:
- 技术栈:Next.js、WordPress、静态 HTML 等
- PWA:站点是否为 PWA 或有规划转为 PWA?
- 现有资产:Logo、图标文件
Required Sizes
要求尺寸
| Size | Use |
|---|---|
| 16x16 | Browser tabs, standard displays |
| 32x32 | Retina/HiDPI browser tabs |
| 180x180 | Apple Touch Icon (iOS home screen); no transparency |
| 192x192 | Android Chrome home screen, PWA launcher |
| 512x512 | PWA splash screens, adaptive icons |
Optional: 48x48, 96x96, 120x120, 152x152, 167x167, 256x256 for broader coverage.
| 尺寸 | 用途 |
|---|---|
| 16x16 | 浏览器标签页,标准显示设备 |
| 32x32 | Retina/高DPI 设备的浏览器标签页 |
| 180x180 | Apple Touch Icon(iOS 主屏幕);不支持透明度 |
| 192x192 | Android Chrome 主屏幕,PWA 启动器 |
| 512x512 | PWA 启动闪屏,自适应图标 |
可选尺寸:48x48、96x96、120x120、152x152、167x167、256x256,用于覆盖更广的场景。
Formats
格式要求
| Format | Use |
|---|---|
| SVG | Modern browsers; scalable; supports dark mode via media queries; lightweight |
| PNG | High-DPI; explicit sizes; easy to generate; required for Apple Touch Icon |
| ICO | Legacy; bundles multiple sizes; fallback for older browsers |
Recommended: Provide SVG + PNG fallbacks. Never skip Apple Touch Icon (180x180); iOS shows a generic screenshot without it.
| 格式 | 用途 |
|---|---|
| SVG | 现代浏览器;可缩放;支持通过媒体查询适配深色模式;体积小 |
| PNG | 高DPI场景;尺寸明确;易于生成;Apple Touch Icon 要求使用该格式 |
| ICO | 兼容旧版浏览器;可打包多个尺寸;作为旧浏览器的降级方案 |
推荐方案:提供 SVG + PNG 降级方案。绝对不要省略 180x180 的 Apple Touch Icon,否则 iOS 会显示站点的通用截图作为替代。
Google Search (SERP Display)
Google 搜索(SERP 展示)
See serp-features for SERP feature types and optimization.
Favicons can appear in Google Search results next to your site's listings. Google Search Central requirements:
| Requirement | Guideline |
|---|---|
| Placement | Add |
| One per hostname | One favicon per hostname; |
| Crawlability | Googlebot-Image must crawl favicon; Googlebot must crawl homepage; do not block either in robots.txt |
| Shape | Square (1:1 aspect ratio); minimum 8x8px; preferably >48x48px for quality across platforms |
| Stable URL | Do not change favicon URL frequently |
| Appropriate | No inappropriate content (pornography, hate symbols); Google may replace with default icon |
| Timing | Crawling can take days to weeks; use Search Console URL Inspection to request indexing |
Supported rel values: , , , . href can be relative () or absolute; favicon can be hosted on CDN.
iconshortcut iconapple-touch-iconapple-touch-icon-precomposed/favicon.icoSERP 功能类型和优化方案可参考 serp-features 相关内容。
Favicon 可在 Google 搜索结果的站点条目旁展示。Google Search Central 要求如下:
| 要求 | 规范 |
|---|---|
| 放置位置 | 在首页的 header 中添加 |
| 每个主机名对应一个 | 每个主机名对应一个 favicon; |
| 可爬取性 | Googlebot-Image 必须能够爬取 favicon,Googlebot 必须能够爬取首页;不要在 robots.txt 中屏蔽二者的爬取权限 |
| 形状 | 正方形(宽高比1:1);最小尺寸 8x8px;推荐大于48x48px,以保证在多平台的展示质量 |
| 稳定的URL | 不要频繁修改 favicon 的 URL |
| 内容合规 | 不得包含违规内容(色情、仇恨符号等),否则 Google 可能会将其替换为默认图标 |
| 生效时间 | 爬取可能需要数天到数周时间;可使用 Search Console 的 URL 检测工具请求索引 |
支持的 rel 属性值:、、、。href 可以是相对路径()或绝对路径;favicon 也可以托管在 CDN 上。
iconshortcut iconapple-touch-iconapple-touch-icon-precomposed/favicon.icoImplementation
实现方式
HTML Link Tags
HTML Link 标签
html
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">html
<link rel="icon" href="/favicon.ico" sizes="any">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32.png">
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">Next.js
Next.js
Place in : , , . Next.js auto-generates tags.
/appfavicon.icoicon.pngapple-icon.png将 、、 放在 目录下,Next.js 会自动生成对应的标签。
favicon.icoicon.pngapple-icon.png/appPWA Manifest
PWA Manifest
Include array in with 192x192 and 512x512 for maskable icons.
iconsmanifest.json在 的 数组中添加 192x192 和 512x512 尺寸的可适配图标。
manifest.jsoniconsBest Practices
最佳实践
- Simplicity: At 16x16, complex details are illegible; use simplified logo mark; design for brand recognition in SERPs
- Consistency: Favicon should match logo/brand (logo-generator, brand-visual-generator)
- Cache: Use long cache; version for updates (e.g. )
/favicon.ico?v=2 - Tools: RealFaviconGenerator, favicon.io, or favicons npm package for automation
- Test: Check across browsers, dark mode, and Search Console (favicon may take days to weeks to appear)
- 简洁性:16x16 尺寸下复杂细节无法识别,建议使用简化的 Logo 标识,设计时要考虑在搜索结果中的品牌辨识度
- 一致性:Favicon 要与 Logo/品牌风格统一(可参考 logo-generator、brand-visual-generator)
- 缓存策略:设置长缓存时间,更新时添加版本号(例如 )
/favicon.ico?v=2 - 工具推荐:可使用 RealFaviconGenerator、favicon.io 或 favicons npm 包实现自动化生成
- 测试验证:在多个浏览器、深色模式下测试,也可在 Search Console 中验证(favicon 可能需要数天到数周才会在搜索结果中更新)
Output Format
输出格式
- Size checklist (16, 32, 180, 192, 512; >48x48 for Google Search)
- Format recommendations (SVG, PNG, ICO)
- Implementation notes per tech stack (homepage header placement)
- Google Search checklist (crawlability, stable URL, appropriate content)
- Manifest (if PWA)
- 尺寸检查清单(16、32、180、192、512;Google 搜索要求大于48x48)
- 格式推荐(SVG、PNG、ICO)
- 实现说明(对应技术栈的首页 header 放置规则)
- Google 搜索检查清单(可爬取性、稳定URL、内容合规)
- Manifest配置(如果是PWA)
Related Skills
相关技能
- logo-generator: Favicon typically derived from logo; consistent branding
- media-kit-page-generator: Media kit should include favicon or link to brand assets
- brand-visual-generator: Visual identity; favicon aligns with brand colors and mark
- indexing: Favicon requires crawlable homepage; URL Inspection for indexing
- logo-generator:Favicon 通常从 Logo 衍生而来,用于保持品牌一致性
- media-kit-page-generator:媒体工具包应包含 favicon 或品牌资产的访问链接
- brand-visual-generator:视觉标识体系,favicon 需要符合品牌配色和标识设计
- indexing:Favicon 要求首页可爬取,可使用URL检测工具请求索引