Skip to content

Commit b917992

Browse files
feat(seo): ping IndexNow when an artist is created already-published
Closes the final-review spec gap: pages/events POST create drafts (pinged on the publish PUT), but an artist can be created published+active, so hook its create route too. Best-effort, gated, non-blocking — mirrors the PUT hooks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent c5f9648 commit b917992

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/app/api/admin/artists/route.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { prisma } from '@/lib/prisma'
55
import { getTenant } from '@/lib/tenant'
66
import { normalizeSlug, isValidSlug, safeHttpsUrl, safeCloudinaryUrl, sanitizeSocials } from '@/lib/artist-validation'
77
import { getArtistsForAdmin } from '@/lib/artists'
8+
import { submitUrls } from '@/lib/indexnow'
89

910
async function getSessionToken() {
1011
const cookieStore = await cookies()
@@ -65,5 +66,11 @@ export async function POST(req: NextRequest) {
6566
updatedById: (token.sub as string) || null,
6667
},
6768
})
69+
// A newly created artist can be published immediately (unlike pages/events,
70+
// which are created as drafts and pinged on the publish PUT). Best-effort;
71+
// no-ops off-prod and never throws.
72+
if (artist.isPublished && artist.isActive) {
73+
void submitUrls([`/kuenstler/${artist.slug}`, '/kuenstler'])
74+
}
6875
return NextResponse.json(artist, { status: 201 })
6976
}

0 commit comments

Comments
 (0)