Compare commits

...
3 Commits
Author SHA1 Message Date
Eric Fennis 457a2d1766 Add robots and theme color 2026-03-26 13:46:39 +01:00
Eric Fennis 8679e10aaa add head config 2026-03-26 12:05:22 +01:00
Eric Fennis e1ee65bc23 Fix site SEO for icon image 2026-03-26 11:53:34 +01:00
3 changed files with 230 additions and 117 deletions
+16 -115
View File
@@ -9,6 +9,7 @@ import { resourcesSidebar } from './sidebar/resources';
import getStructuredData from './getStructuredData';
import { createGeneralOGImage, createIconOGImage } from './createOGImage';
import llmstxt from 'vitepress-plugin-llms';
import getHead from './getHead';
const defaultSandpackCSS = await readFile(
fileURLToPath(new URL('./theme/sandpack-default.css', import.meta.url)),
@@ -76,121 +77,7 @@ export default defineConfig({
}),
],
},
head: [
[
'link',
{
rel: 'preconnect',
href: 'https://analytics.lucide.dev',
},
],
[
'script',
{
src: 'https://analytics.lucide.dev/js/script.js',
'data-domain': 'lucide.dev',
defer: '',
},
],
[
'meta',
{
property: 'og:locale',
content: 'en_US',
},
],
[
'meta',
{
property: 'og:type',
content: 'website',
},
],
[
'meta',
{
property: 'og:site_name',
content: title,
},
],
[
'meta',
{
property: 'og:title',
content: socialTitle,
},
],
[
'meta',
{
property: 'og:description',
content: description,
},
],
[
'meta',
{
property: 'og:url',
content: 'https://lucide.dev',
},
],
[
'meta',
{
property: 'og:image',
content: 'https://lucide.dev/og.png',
},
],
[
'meta',
{
property: 'og:image:width',
content: '1200',
},
],
[
'meta',
{
property: 'og:image:height',
content: '630',
},
],
[
'meta',
{
property: 'og:image:type',
content: 'image/png',
},
],
[
'meta',
{
property: 'twitter:card',
content: 'summary_large_image',
},
],
[
'meta',
{
property: 'twitter:title',
content: socialTitle,
},
],
[
'meta',
{
property: 'twitter:description',
content: description,
},
],
[
'meta',
{
property: 'twitter:image',
content: 'https://lucide.dev/og.png',
},
],
],
head: getHead({ title, socialTitle, description }),
async transformPageData(pageData) {
pageData.frontmatter.head ??= [];
if (
@@ -218,6 +105,20 @@ export default defineConfig({
if (ogPath) {
const content = `https://lucide.dev${ogPath}`;
pageData.frontmatter.head.push(
[
'meta',
{
property: 'og:title',
content: pageData.title,
},
],
[
'meta',
{
property: 'og:description',
content: pageData.description,
},
],
[
'meta',
{
+208
View File
@@ -0,0 +1,208 @@
import { HeadConfig } from "vitepress"
interface GetHeadOptions {
title: string;
socialTitle: string;
description: string;
}
const brandColor = '#f56565'
const getHead = ({ title, socialTitle, description }: GetHeadOptions): HeadConfig[] => [
// Favicons and meta tags
[
'meta',
{
name: 'robots',
content: 'index,follow',
},
],
[
'meta',
{
name: 'theme-color',
content: brandColor,
},
],
[
'link',
{
rel: 'shortcut icon',
href: '/favicon.ico',
sizes: 'any',
},
],
[
'link',
{
rel: 'icon',
href: '/favicon.svg',
type: 'image/svg+xml',
},
],
[
'link',
{
rel: 'apple-touch-icon',
href: '/apple-touch-icon.png',
sizes: '180x180',
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
href: '/favicon-32x32.png',
sizes: '32x32',
},
],
[
'link',
{
rel: 'icon',
type: 'image/png',
href: '/favicon-16x16.png',
sizes: '16x16',
},
],
[
'link',
{
rel: 'mask-icon',
href: '/safari-pinned-tab.svg',
color: brandColor,
},
],
// Analytics
[
'link',
{
rel: 'preconnect',
href: 'https://analytics.lucide.dev',
},
],
[
'script',
{
src: 'https://analytics.lucide.dev/js/script.js',
'data-domain': 'lucide.dev',
defer: '',
},
],
// Open Graph and Twitter Card meta tags
[
'meta',
{
property: 'og:locale',
content: 'en_US',
},
],
[
'meta',
{
property: 'og:type',
content: 'website',
},
],
[
'meta',
{
property: 'og:site_name',
content: title,
},
],
[
'meta',
{
property: 'og:title',
content: socialTitle,
},
],
[
'meta',
{
property: 'og:description',
content: description,
},
],
[
'meta',
{
property: 'og:url',
content: 'https://lucide.dev',
},
],
[
'meta',
{
property: 'og:image',
content: 'https://lucide.dev/og.png',
},
],
[
'meta',
{
property: 'og:image:width',
content: '1200',
},
],
[
'meta',
{
property: 'og:image:height',
content: '630',
},
],
[
'meta',
{
property: 'og:image:type',
content: 'image/png',
},
],
[
'meta',
{
property: 'og:image:alt',
content: 'Lucide icon library preview image',
},
],
[
'meta',
{
property: 'twitter:card',
content: 'summary_large_image',
},
],
[
'meta',
{
property: 'twitter:site',
content: '@lucide_icons',
},
],
[
'meta',
{
property: 'twitter:title',
content: socialTitle,
},
],
[
'meta',
{
property: 'twitter:description',
content: description,
},
],
[
'meta',
{
property: 'twitter:image',
content: 'https://lucide.dev/og.png',
},
],
]
export default getHead
+6 -2
View File
@@ -29,8 +29,12 @@ export default async function getStructuredData(iconName: string, pageData: Page
name: iconName,
// TODO: Add support for description extraction from icon metadata
// description: 'An ...SVG icon from the Lucide icon set.',
contentUrl: `https://lucide.dev/api/icons/${iconName}}?width=24&height=24&background=white`,
thumbnailUrl: `https://lucide.dev/api/icons/${iconName}}?width=256&height=256&background=white`,
contentUrl: `https://lucide.dev/api/icons/${iconName}?width=24&height=24&background=white`,
thumbnailUrl: `https://lucide.dev/api/icons/${iconName}?width=256&height=256&background=white`,
acquireLicensePage: 'https://lucide.dev/license',
license: 'https://lucide.dev/license',
copyrightNotice: 'Copyright (c) 2026 Lucide Icons and Contributors',
creditText: 'Lucide Icons',
encodingFormat: 'image/svg+xml',
keywords: pageData.params?.tags,
width: 24,