From 4b9c88219b9f7c5d9b6eb1cc6cc996d8cd428656 Mon Sep 17 00:00:00 2001 From: Guy Sartorelli Date: Fri, 22 Jul 2022 12:16:51 +1200 Subject: [PATCH] FIX Rewrite API links for the correct version. CMS3 docs shouldn't link to CMS4 API, for example. --- src/utils/rewriteAPILink.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/rewriteAPILink.ts b/src/utils/rewriteAPILink.ts index c9fe60c..4305c3c 100644 --- a/src/utils/rewriteAPILink.ts +++ b/src/utils/rewriteAPILink.ts @@ -1,9 +1,11 @@ +import { getCurrentVersion } from './nodes'; + /** * If an href is preceded with api:, rewrite it to the api.silverstripe.org site * @param link */ const rewriteAPILink = (link: string): string => { - const version = 4; + const version = getCurrentVersion(); const match = link.match(/api\:(.*)/); if (!match) { console.error(`Unable to resolve api link ${link}!`);