diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 547a14faa..c8546b469 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -68,6 +68,12 @@ export default defineConfig({ new URL('./theme/components/overrides/VPCarbonAds.vue', import.meta.url), ), }, + { + find: /^.*\/VPNavBarSearch\.vue$/, + replacement: fileURLToPath( + new URL('./theme/components/overrides/VPNavBarSearch.vue', import.meta.url), + ), + }, { find: '~/.vitepress', replacement: fileURLToPath(new URL('./', import.meta.url)), @@ -125,6 +131,14 @@ export default defineConfig({ editLink: { pattern: 'https://github.com/lucide-icons/lucide/edit/main/docs/:path', }, + search: { + provider: 'algolia', + options: { + appId: 'R7KKMCPXOB', + apiKey: 'dd3101054267d35fb28f49c42715f1aa', + indexName: 'lucide' + } + }, carbonAds: { code: 'CWYIC53U', placement: 'lucidedev', diff --git a/docs/.vitepress/getStructuredData.ts b/docs/.vitepress/getStructuredData.ts index 2ac47df1e..7fde3ff12 100644 --- a/docs/.vitepress/getStructuredData.ts +++ b/docs/.vitepress/getStructuredData.ts @@ -1,7 +1,19 @@ import { PageData } from 'vitepress'; +/** + * Mirrors the notices in the repo's LICENSE file, which is bumped by hand — keep the + * year here in step with it. + */ +const LUCIDE_COPYRIGHT = 'Copyright (c) 2026 Lucide Icons and Contributors'; +const FEATHER_COPYRIGHT = 'Copyright (c) 2013-present Cole Bemis'; +const LICENSE_URL = 'https://lucide.dev/license'; + export default async function getStructuredData(iconName: string, pageData: PageData) { - const url = `https://lucide.dev/icons/${iconName}`; + const params = pageData.params ?? {}; + const isLab = params.externalLibrary === 'lab'; + const url = `https://lucide.dev/icons/${isLab ? 'lab/' : ''}${iconName}`; + + const awaitingRelease = Boolean(params.awaitingRelease); return { '@context': 'https://schema.org', @@ -29,18 +41,41 @@ 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`, + // `/api/icons/` only renders core icons, a lab name would 404 there. + ...(isLab + ? {} + : { + 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`, + }), encodingFormat: 'image/svg+xml', - keywords: pageData.params?.tags, + keywords: params.tags, width: 24, height: 24, creator: { '@type': 'Organization', name: 'Lucide Icons', }, - datePublished: pageData?.params?.createdRelease?.date, - dateModified: pageData?.params?.changedRelease?.date, + license: LICENSE_URL, + acquireLicensePage: LICENSE_URL, + // The Feather-derived icons are MIT © Cole Bemis; everything else is ISC. Lab + // icons carry no release metadata, so they fall to the ISC-only notice. + copyrightNotice: params.fromFork + ? `${LUCIDE_COPYRIGHT}; ${FEATHER_COPYRIGHT}` + : LUCIDE_COPYRIGHT, + creditText: 'Lucide Icons', + // Both dates fall back to the date of the fork for unreleased icons, so neither + ...(awaitingRelease + ? {} + : { + ...(params.createdRelease?.date ? { datePublished: params.createdRelease.date } : {}), + ...(params.changedRelease?.date ? { dateModified: params.changedRelease.date } : {}), + }), + + // Custom attributes, picked up by the Algolia crawler to rank and sort the icon + // index. Not schema.org vocabulary, consumers that don't know them ignore them. + popularity: params.popularity ?? 0, + awaitingRelease, }, }; } diff --git a/docs/.vitepress/theme/components/guide/FrameworkSelect.vue b/docs/.vitepress/theme/components/guide/FrameworkSelect.vue index 51e3bd4da..dd1b25367 100644 --- a/docs/.vitepress/theme/components/guide/FrameworkSelect.vue +++ b/docs/.vitepress/theme/components/guide/FrameworkSelect.vue @@ -1,10 +1,10 @@