Skip to content

Commit ba0ec18

Browse files
committed
fix: docs link and homepage coexist
1 parent e277a2d commit ba0ec18

1 file changed

Lines changed: 12 additions & 26 deletions

File tree

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

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -218,28 +218,14 @@ const homepageUrl = computed(() => {
218218
return homepage
219219
})
220220
221-
// Docs URL: prefer package's homepage (often their docs site), fall back to our API docs
221+
// Docs URL: use our generated API docs
222222
const docsLink = computed(() => {
223-
const homepage = displayVersion.value?.homepage
224-
if (homepage) {
225-
return {
226-
href: homepage,
227-
isExternal: true,
228-
}
229-
}
223+
if (!displayVersion.value) return null
230224
231-
// Fall back to our generated API docs
232-
if (displayVersion.value) {
233-
return {
234-
to: {
235-
name: 'docs' as const,
236-
params: { path: [...pkg.value!.name.split('/'), 'v', displayVersion.value.version] },
237-
},
238-
isExternal: false,
239-
}
225+
return {
226+
name: 'docs' as const,
227+
params: { path: [...pkg.value!.name.split('/'), 'v', displayVersion.value.version] },
240228
}
241-
242-
return null
243229
})
244230
245231
function normalizeGitUrl(url: string): string {
@@ -740,20 +726,20 @@ defineOgImageComponent('Package', {
740726
{{ t('package.links.jsr') }}
741727
</a>
742728
</li>
743-
<li v-if="docsLink">
729+
<li v-if="homepageUrl">
744730
<a
745-
v-if="docsLink.isExternal"
746-
:href="docsLink.href"
731+
:href="homepageUrl"
747732
target="_blank"
748733
rel="noopener noreferrer"
749734
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
750735
>
751-
<span class="i-carbon-document w-4 h-4" aria-hidden="true" />
752-
{{ t('package.links.docs') }}
736+
<span class="i-carbon-link w-4 h-4" aria-hidden="true" />
737+
{{ t('package.links.homepage') }}
753738
</a>
739+
</li>
740+
<li v-if="docsLink">
754741
<NuxtLink
755-
v-else
756-
:to="docsLink.to"
742+
:to="docsLink"
757743
class="link-subtle font-mono text-sm inline-flex items-center gap-1.5"
758744
>
759745
<span class="i-carbon-document w-4 h-4" aria-hidden="true" />

0 commit comments

Comments
 (0)