diff --git a/astro.config.mjs b/astro.config.mjs index 6daf25bb..8312dae8 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -39,6 +39,9 @@ export default defineConfig({ title: 'Docs', favicon: '/images/favicons/favicon.ico', customCss: ['./src/styles/global.css'], + components: { + PageTitle: './src/components/PageTitleWithPricing.astro', + }, head: [ { tag: 'script', diff --git a/src/components/PageTitleWithPricing.astro b/src/components/PageTitleWithPricing.astro new file mode 100644 index 00000000..ce150a0d --- /dev/null +++ b/src/components/PageTitleWithPricing.astro @@ -0,0 +1,76 @@ +--- +import Default from '@astrojs/starlight/components/PageTitle.astro'; + +// Get the current page route +const route = Astro.locals.starlightRoute; +const isAwsServicePage = route.id.startsWith('aws/services/') && !route.id.includes('/index'); +const tags = route.entry?.data?.tags || []; + +const pricingTags = tags.filter(tag => + ['Free', 'Base', 'Ultimate'].includes(tag) +); + +const getAvailablePlans = (plans) => { + if (plans.includes('Free')) { + return ['Free', 'Base', 'Ultimate']; + } else if (plans.includes('Base')) { + return ['Base', 'Ultimate']; + } else if (plans.includes('Ultimate')) { + return ['Ultimate']; + } + return plans; +}; + +const availablePlans = getAvailablePlans(pricingTags); +--- + + + +{isAwsServicePage && availablePlans.length > 0 && ( +
+ {availablePlans.map(plan => ( + + {plan} + + ))} +
+)} + + diff --git a/src/content.config.ts b/src/content.config.ts index dfe27891..e7ef5a39 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -12,6 +12,7 @@ export const collections = { deployment: z.array(z.string()).optional(), pro: z.boolean().optional(), leadimage: z.string().optional(), + tags: z.array(z.string()).optional(), }), }), }),