diff --git a/src/components/CompareEditions.astro b/src/components/CompareEditions.astro new file mode 100644 index 0000000..94826b6 --- /dev/null +++ b/src/components/CompareEditions.astro @@ -0,0 +1,65 @@ +--- +/** + * CompareEditions button - shows a button to compare the current AEP with other editions + */ +import { Icon } from '@astrojs/starlight/components' +import editionsConfig from '../../aep-editions.json' +import { getEditionFromPath, isVersionedPage } from '../utils/versions' + +const currentEdition = getEditionFromPath(editionsConfig, Astro.url.pathname) +const showCompareButton = isVersionedPage(Astro.url.pathname) + +// Extract AEP ID from path +const pathSegments = Astro.url.pathname.split('/').filter(Boolean) +const aepId = pathSegments[pathSegments.length - 1] + +// Only show if we have multiple editions +const hasMultipleEditions = editionsConfig.editions.length > 1 +--- + +{showCompareButton && hasMultipleEditions && ( +
+ Comparing editions: + {fromEd.name} → {toEd.name} +
+ + { + availableEditions.length > 2 && ( +