$npx -y skills add addyosmani/web-quality-skills --skill seoOptimize for search engine visibility and ranking. Use when asked to "improve SEO", "optimize for search", "fix meta tags", "add structured data", "sitemap optimization", or "search engine optimization".
| 1 | # SEO optimization |
| 2 | |
| 3 | Search engine optimization based on Lighthouse SEO audits and Google Search guidelines. Focus on technical SEO, on-page optimization, and structured data. |
| 4 | |
| 5 | ## SEO fundamentals |
| 6 | |
| 7 | Search ranking factors (approximate influence): |
| 8 | |
| 9 | | Factor | Influence | This Skill | |
| 10 | |--------|-----------|------------| |
| 11 | | Content quality & relevance | ~40% | Partial (structure) | |
| 12 | | Backlinks & authority | ~25% | ✗ | |
| 13 | | Technical SEO | ~15% | ✓ | |
| 14 | | Page experience (Core Web Vitals) | ~10% | See [Core Web Vitals](../core-web-vitals/SKILL.md) | |
| 15 | | On-page SEO | ~10% | ✓ | |
| 16 | |
| 17 | --- |
| 18 | |
| 19 | ## Technical SEO |
| 20 | |
| 21 | ### Crawlability |
| 22 | |
| 23 | **robots.txt:** |
| 24 | ```text |
| 25 | # /robots.txt |
| 26 | User-agent: * |
| 27 | Allow: / |
| 28 | |
| 29 | # Block admin/private areas |
| 30 | Disallow: /admin/ |
| 31 | Disallow: /api/ |
| 32 | Disallow: /private/ |
| 33 | |
| 34 | # Don't block resources needed for rendering |
| 35 | # ❌ Disallow: /static/ |
| 36 | |
| 37 | Sitemap: https://example.com/sitemap.xml |
| 38 | ``` |
| 39 | |
| 40 | **Meta robots:** |
| 41 | ```html |
| 42 | <!-- Default: indexable, followable --> |
| 43 | <meta name="robots" content="index, follow"> |
| 44 | |
| 45 | <!-- Noindex specific pages --> |
| 46 | <meta name="robots" content="noindex, nofollow"> |
| 47 | |
| 48 | <!-- Indexable but don't follow links --> |
| 49 | <meta name="robots" content="index, nofollow"> |
| 50 | |
| 51 | <!-- Control snippets --> |
| 52 | <meta name="robots" content="max-snippet:150, max-image-preview:large"> |
| 53 | ``` |
| 54 | |
| 55 | **Canonical URLs:** |
| 56 | ```html |
| 57 | <!-- Prevent duplicate content issues --> |
| 58 | <link rel="canonical" href="https://example.com/page"> |
| 59 | |
| 60 | <!-- Self-referencing canonical (recommended) --> |
| 61 | <link rel="canonical" href="https://example.com/current-page"> |
| 62 | |
| 63 | <!-- For paginated content --> |
| 64 | <link rel="canonical" href="https://example.com/products"> |
| 65 | <!-- Or use rel="prev" / rel="next" for explicit pagination --> |
| 66 | ``` |
| 67 | |
| 68 | ### XML sitemap |
| 69 | |
| 70 | ```xml |
| 71 | <?xml version="1.0" encoding="UTF-8"?> |
| 72 | <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
| 73 | <url> |
| 74 | <loc>https://example.com/</loc> |
| 75 | <lastmod>2024-01-15</lastmod> |
| 76 | <changefreq>daily</changefreq> |
| 77 | <priority>1.0</priority> |
| 78 | </url> |
| 79 | <url> |
| 80 | <loc>https://example.com/products</loc> |
| 81 | <lastmod>2024-01-14</lastmod> |
| 82 | <changefreq>weekly</changefreq> |
| 83 | <priority>0.8</priority> |
| 84 | </url> |
| 85 | </urlset> |
| 86 | ``` |
| 87 | |
| 88 | **Sitemap best practices:** |
| 89 | - Maximum 50,000 URLs or 50MB per sitemap |
| 90 | - Use sitemap index for larger sites |
| 91 | - Include only canonical, indexable URLs |
| 92 | - Update `lastmod` when content changes |
| 93 | - Submit to Google Search Console |
| 94 | |
| 95 | ### URL structure |
| 96 | |
| 97 | ``` |
| 98 | ✅ Good URLs: |
| 99 | https://example.com/products/blue-widget |
| 100 | https://example.com/blog/how-to-use-widgets |
| 101 | |
| 102 | ❌ Poor URLs: |
| 103 | https://example.com/p?id=12345 |
| 104 | https://example.com/products/item/category/subcategory/blue-widget-2024-sale-discount |
| 105 | ``` |
| 106 | |
| 107 | **URL guidelines:** |
| 108 | - Use hyphens, not underscores |
| 109 | - Lowercase only |
| 110 | - Keep short (< 75 characters) |
| 111 | - Include target keywords naturally |
| 112 | - Avoid parameters when possible |
| 113 | - Use HTTPS always |
| 114 | |
| 115 | ### HTTPS & security |
| 116 | |
| 117 | ```html |
| 118 | <!-- Ensure all resources use HTTPS --> |
| 119 | <img src="https://example.com/image.jpg"> |
| 120 | |
| 121 | <!-- Not: --> |
| 122 | <img src="http://example.com/image.jpg"> |
| 123 | ``` |
| 124 | |
| 125 | **Security headers for SEO trust signals:** |
| 126 | ``` |
| 127 | Strict-Transport-Security: max-age=31536000; includeSubDomains |
| 128 | X-Content-Type-Options: nosniff |
| 129 | X-Frame-Options: DENY |
| 130 | ``` |
| 131 | |
| 132 | --- |
| 133 | |
| 134 | ## On-page SEO |
| 135 | |
| 136 | ### Title tags |
| 137 | |
| 138 | ```html |
| 139 | <!-- ❌ Missing or generic --> |
| 140 | <title>Page</title> |
| 141 | <title>Home</title> |
| 142 | |
| 143 | <!-- ✅ Descriptive with primary keyword --> |
| 144 | <title>Blue Widgets for Sale | Premium Quality | Example Store</title> |
| 145 | ``` |
| 146 | |
| 147 | **Title tag guidelines:** |
| 148 | - 50-60 characters (Google truncates ~60) |
| 149 | - Primary keyword near the beginning |
| 150 | - Unique for every page |
| 151 | - Brand name at end (unless homepage) |
| 152 | - Action-oriented when appropriate |
| 153 | |
| 154 | ### Meta descriptions |
| 155 | |
| 156 | ```html |
| 157 | <!-- ❌ Missing or duplicate --> |
| 158 | <meta name="description" content=""> |
| 159 | |
| 160 | <!-- ✅ Compelling and unique --> |
| 161 | <meta name="description" content="Shop premium blue widgets with free shipping. 30-day returns. Rated 4.9/5 by 10,000+ customers. Order today and save 20%."> |
| 162 | ``` |
| 163 | |
| 164 | **Meta description guidelines:** |
| 165 | - 150-160 characters |
| 166 | - Include primary keyword naturally |
| 167 | - Compelling call-to-action |
| 168 | - Unique for every page |
| 169 | - Matches page content |
| 170 | |
| 171 | ### Heading structure |
| 172 | |
| 173 | ```html |
| 174 | <!-- ❌ Poor structure --> |
| 175 | <h2>Welcome to Our Store</h2> |
| 176 | <h4>Products</h4> |
| 177 | <h1>Contact Us</h1> |
| 178 | |
| 179 | <!-- ✅ Proper hierarchy --> |
| 180 | <h1>Blue Widgets - Premium Quality</h1> |
| 181 | <h2>Product Features</h2> |
| 182 | <h3>Durability</h3> |
| 183 | <h3>Design</h3> |
| 184 | <h2>Customer Reviews</h2> |
| 185 | <h2>Pricing</h2> |
| 186 | ``` |
| 187 | |
| 188 | **Heading guidelines:** |
| 189 | - Single `<h1>` per page (the main topic) |
| 190 | - Logical hierarchy (don't skip levels) |
| 191 | - Include keywords naturally |
| 192 | - Descriptive, not generic |
| 193 | |
| 194 | ### Image SEO |
| 195 | |
| 196 | ```html |
| 197 | <!-- ❌ Poor image SEO --> |
| 198 | <img src="IMG_12345.jpg"> |
| 199 | |
| 200 | <!-- ✅ Optimized image --> |
| 201 | <img src="blue-widget-product-photo.webp" |
| 202 | alt="Blue widget with chrome finish, side vi |