From eedc14699140f880051edcd226de5f2359b12496 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 30 Sep 2026 14:58:29 +1000 Subject: [PATCH] feat(badge): show README badge only on indexable hubs, noindex kit A badge that links to a noindex hub earns nothing, so the hub hides the badge block unless seoIndexable. The brand kit page is a tool page, so it is now noindex. --- app/pages/brand-kit/github-badge.vue | 2 +- .../app/pages/gh/[owner]/[repo]/index.vue | 8 ++++--- test/unit/github-badge-brand-kit.test.ts | 12 ++++++++++ test/unit/skill-badge.test.ts | 22 +++++++++++++++++++ 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/pages/brand-kit/github-badge.vue b/app/pages/brand-kit/github-badge.vue index b9699a6d..6a9278bf 100644 --- a/app/pages/brand-kit/github-badge.vue +++ b/app/pages/brand-kit/github-badge.vue @@ -20,7 +20,7 @@ const readmeSnippetInput = { useSeoMeta({ title: 'GitHub badge ยท Brand kit', description: 'Add the skilld badge to a README. It links readers to the Skill or Repository page and shows no counts.', - robots: 'index,follow', + robots: 'noindex,follow', }) useHead({ diff --git a/layers/registry/app/pages/gh/[owner]/[repo]/index.vue b/layers/registry/app/pages/gh/[owner]/[repo]/index.vue index 7eed8556..7ea8ce2e 100644 --- a/layers/registry/app/pages/gh/[owner]/[repo]/index.vue +++ b/layers/registry/app/pages/gh/[owner]/[repo]/index.vue @@ -458,7 +458,7 @@ useHead(computed(() => ({ color="neutral" variant="ghost" /> - + @@ -698,9 +698,11 @@ useHead(computed(() => ({ - + diff --git a/test/unit/github-badge-brand-kit.test.ts b/test/unit/github-badge-brand-kit.test.ts index 2fe10aaa..393e5b0f 100644 --- a/test/unit/github-badge-brand-kit.test.ts +++ b/test/unit/github-badge-brand-kit.test.ts @@ -1,6 +1,7 @@ import { mountSuspended } from '@nuxt/test-utils/runtime' import { describe, expect, it } from 'vitest' import { nextTick } from 'vue' +import { injectHead, useNuxtApp } from '#imports' import GithubBadgePage from '../../app/pages/brand-kit/github-badge.vue' describe('github badge brand kit', () => { @@ -15,4 +16,15 @@ describe('github badge brand kit', () => { expect(wrapper.get('.github-readme').attributes('data-github-theme')).toBe('dark') }) + + it('stays out of the index because it is a tool page, not a target', async () => { + await mountSuspended(GithubBadgePage) + const head = useNuxtApp().vueApp.runWithContext(() => injectHead()) + const robots = [...head.entries.values()] + .flatMap(entry => (entry.input as { meta?: Array<{ name?: string, content?: string }> }).meta ?? []) + .filter(meta => meta.name === 'robots') + .map(meta => meta.content) + + expect([...new Set(robots)]).toEqual(['noindex,follow']) + }) }) diff --git a/test/unit/skill-badge.test.ts b/test/unit/skill-badge.test.ts index fd01997f..c1348bfa 100644 --- a/test/unit/skill-badge.test.ts +++ b/test/unit/skill-badge.test.ts @@ -28,6 +28,28 @@ describe('skill badge', () => { `) }) + it('links a multi-skill repository badge to the repository hub, not its first skill', () => { + const input = { + owner: 'antfu', + repo: 'skills', + name: 'vite', + registryPath: '/gh/antfu/skills', + } + + expect(skillBadgeImagePath(input)).toBe('/b/antfu/skills') + expect(skillBadgeEmbed(input)).toContain('') + expect(skillBadgeEmbed(input)).toContain('Skill repository on skilld.dev') + }) + + it('links a skill badge to the canonical skill URL', () => { + expect(skillBadgeEmbed({ + owner: 'antfu', + repo: 'skills', + name: 'vite', + registryPath: '/gh/antfu/skills/vite', + })).toContain('') + }) + it('keeps the skill name for a multi-skill repository', () => { expect(skillBadgeEmbed({ owner: 'antfu',