mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 15:05:50 +00:00
FIX Rewrite API links for the correct version.
CMS3 docs shouldn't link to CMS4 API, for example.
This commit is contained in:
parent
a0de65a48a
commit
4b9c88219b
@ -1,9 +1,11 @@
|
|||||||
|
import { getCurrentVersion } from './nodes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If an href is preceded with api:, rewrite it to the api.silverstripe.org site
|
* If an href is preceded with api:, rewrite it to the api.silverstripe.org site
|
||||||
* @param link
|
* @param link
|
||||||
*/
|
*/
|
||||||
const rewriteAPILink = (link: string): string => {
|
const rewriteAPILink = (link: string): string => {
|
||||||
const version = 4;
|
const version = getCurrentVersion();
|
||||||
const match = link.match(/api\:(.*)/);
|
const match = link.match(/api\:(.*)/);
|
||||||
if (!match) {
|
if (!match) {
|
||||||
console.error(`Unable to resolve api link ${link}!`);
|
console.error(`Unable to resolve api link ${link}!`);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user