From 53cd585e9e3262a54ff4833baf06aa71e26a044f Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Thu, 17 Apr 2025 11:14:12 +0200 Subject: [PATCH] Fix plugin slug in list view (#5099) --- docs/plugins/woodpecker-plugins/src/index.ts | 3 ++- .../woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx | 2 +- docs/plugins/woodpecker-plugins/src/types.ts | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/plugins/woodpecker-plugins/src/index.ts b/docs/plugins/woodpecker-plugins/src/index.ts index ae865b7e4..8c8958500 100644 --- a/docs/plugins/woodpecker-plugins/src/index.ts +++ b/docs/plugins/woodpecker-plugins/src/index.ts @@ -56,6 +56,7 @@ async function loadContent(): Promise { return { name: docsHeader.name, + slug: slugify(docsHeader.name, { lower: true, strict: true }), url: docsHeader.url, icon: docsHeader.icon, description: docsHeader.description, @@ -92,7 +93,7 @@ async function contentLoaded({ const pluginJsonPath = await createData(`plugin-${i}.json`, JSON.stringify(plugin)); addRoute({ - path: `/plugins/${slugify(plugin.name, { lower: true, strict: true })}`, + path: `/plugins/${plugin.slug}`, component: '@theme/WoodpeckerPlugin', modules: { plugin: pluginJsonPath, diff --git a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx index 266236f7e..c933f5185 100644 --- a/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx +++ b/docs/plugins/woodpecker-plugins/src/theme/WoodpeckerPluginList.tsx @@ -8,7 +8,7 @@ import { WoodpeckerPlugin } from '../types'; import { IconPlugin, IconVerified } from './Icons'; function PluginPanel({ plugin }: { plugin: WoodpeckerPlugin }) { - const pluginUrl = `/plugins/${plugin.name}`; + const pluginUrl = `/plugins/${plugin.slug}`; return ( diff --git a/docs/plugins/woodpecker-plugins/src/types.ts b/docs/plugins/woodpecker-plugins/src/types.ts index 668fe186e..db325954a 100644 --- a/docs/plugins/woodpecker-plugins/src/types.ts +++ b/docs/plugins/woodpecker-plugins/src/types.ts @@ -17,6 +17,7 @@ export type WoodpeckerPluginIndexEntry = { export type WoodpeckerPlugin = WoodpeckerPluginHeader & { name: string; + slug: string; docs: string; // body of the docs .md file verified: boolean; // we set verified to false when not explicitly set iconDataUrl?: string;