Skip to content

Commit 00b80ec

Browse files
committed
fix: og image alts
1 parent 533a466 commit 00b80ec

17 files changed

Lines changed: 141 additions & 63 deletions

File tree

app/app.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if (import.meta.client) {
128128
129129
// title and description will be inferred
130130
// this will be overridden by upstream pages that use different templates
131-
defineOgImage('Page.takumi')
131+
defineOgImage('Page.takumi', {}, { alt: 'npmx — a fast, modern browser for the npm registry' })
132132
</script>
133133

134134
<template>

app/components/global/BlogPostWrapper.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ useHead({
2727
],
2828
})
2929
30-
defineOgImage('BlogPost.takumi', {
31-
title: props.frontmatter.title,
32-
authors: post.value?.authors ?? [],
33-
date: props.frontmatter.date,
34-
})
30+
defineOgImage(
31+
'BlogPost.takumi',
32+
{
33+
title: props.frontmatter.title,
34+
authors: post.value?.authors ?? [],
35+
date: props.frontmatter.date,
36+
},
37+
{ alt: `Blog post: ${props.frontmatter.title}` },
38+
)
3539
3640
const slug = computed(() => props.frontmatter.slug)
3741

app/pages/about.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ useSeoMeta({
1515
twitterDescription: () => $t('about.meta_description'),
1616
})
1717
18-
defineOgImage('Page.takumi', {
19-
title: () => `${$t('about.title')}`,
20-
description: 'a fast, modern browser for the npm registry',
21-
})
18+
defineOgImage(
19+
'Page.takumi',
20+
{
21+
title: () => `${$t('about.title')}`,
22+
description: 'a fast, modern browser for the npm registry',
23+
},
24+
{ alt: () => `${$t('about.title')} — npmx` },
25+
)
2226
2327
const pmLinks = {
2428
npm: 'https://www.npmjs.com/',

app/pages/accessibility.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ useSeoMeta({
88
description: () => $t('a11y.welcome', { app: 'npmx' }),
99
})
1010
11-
defineOgImage('Page.takumi', {
12-
title: () => $t('a11y.title'),
13-
description: () => $t('a11y.welcome', { app: 'npmx' }),
14-
})
11+
defineOgImage(
12+
'Page.takumi',
13+
{
14+
title: () => $t('a11y.title'),
15+
description: () => $t('a11y.welcome', { app: 'npmx' }),
16+
},
17+
{ alt: () => `${$t('a11y.title')} — npmx` },
18+
)
1519
1620
const router = useRouter()
1721
const canGoBack = useCanGoBack()

app/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ useSeoMeta({
1919
twitterDescription: () => $t('seo.home.description'),
2020
})
2121
22-
defineOgImage('Splash.takumi')
22+
defineOgImage('Splash.takumi', {}, { alt: () => $t('seo.home.description') })
2323
</script>
2424

2525
<template>

app/pages/org/[org].vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,14 @@ useSeoMeta({
139139
twitterDescription: () => `npm packages published by the ${orgName.value} organization`,
140140
})
141141
142-
defineOgImage('Page.takumi', {
143-
title: () => `@${orgName.value}`,
144-
description: () => (packageCount.value ? `${packageCount.value} packages` : 'npm organization'),
145-
})
142+
defineOgImage(
143+
'Page.takumi',
144+
{
145+
title: () => `@${orgName.value}`,
146+
description: () => (packageCount.value ? `${packageCount.value} packages` : 'npm organization'),
147+
},
148+
{ alt: () => `@${orgName.value} npm organization on npmx` },
149+
)
146150
</script>
147151

148152
<template>

app/pages/package-code/[[org]]/[packageName]/v/[version]/[...filePath].vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,15 @@ defineOgImage(
312312
version: () => version.value,
313313
variant: 'code-tree',
314314
},
315-
[{ key: 'og' }, { key: 'whatsapp', width: 800, height: 800 }],
315+
[
316+
{ key: 'og', alt: () => `Source code file tree for ${packageName.value}@${version.value}` },
317+
{
318+
key: 'whatsapp',
319+
width: 800,
320+
height: 800,
321+
alt: () => `Source code file tree for ${packageName.value}@${version.value}`,
322+
},
323+
],
316324
)
317325
</script>
318326

app/pages/package-docs/[...path].vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,15 @@ defineOgImage(
125125
version: () => resolvedVersion.value,
126126
variant: 'function-tree',
127127
},
128-
[{ key: 'og' }, { key: 'whatsapp', width: 800, height: 800 }],
128+
[
129+
{ key: 'og', alt: () => `API documentation for ${packageName.value}` },
130+
{
131+
key: 'whatsapp',
132+
width: 800,
133+
height: 800,
134+
alt: () => `API documentation for ${packageName.value}`,
135+
},
136+
],
129137
)
130138
131139
const showLoading = computed(

app/pages/package/[[org]]/[name].vue

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,15 @@ defineOgImage(
4242
version: () => requestedVersion.value,
4343
variant: 'download-chart',
4444
},
45-
[{ key: 'og' }, { key: 'whatsapp', width: 800, height: 800 }],
45+
[
46+
{ key: 'og', alt: () => `npm package ${packageName.value} download chart and stats` },
47+
{
48+
key: 'whatsapp',
49+
width: 800,
50+
height: 800,
51+
alt: () => `npm package ${packageName.value} download chart and stats`,
52+
},
53+
],
4654
)
4755
4856
if (import.meta.server) {

app/pages/pds.vue

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ useSeoMeta({
1313
twitterDescription: () => $t('pds.meta_description'),
1414
})
1515
16-
defineOgImage('Page.takumi', {
17-
title: 'npmx.social',
18-
description: 'The official PDS for the npmx community.',
19-
})
16+
defineOgImage(
17+
'Page.takumi',
18+
{
19+
title: 'npmx.social',
20+
description: 'The official PDS for the npmx community.',
21+
},
22+
{ alt: 'npmx.social — the official PDS for the npmx community' },
23+
)
2024
2125
const brokenImages = ref(new Set<string>())
2226

0 commit comments

Comments
 (0)