diff --git a/website/src/plugins/remark-version-replace/index.js b/website/src/plugins/remark-version-replace/index.js index b58db5652a..26ef565e43 100644 --- a/website/src/plugins/remark-version-replace/index.js +++ b/website/src/plugins/remark-version-replace/index.js @@ -26,7 +26,9 @@ VERSIONS.map((version) => { }); function getDocsVersionName(pathname) { - const parts = pathname.split('/'); + // split on both POSIX ('/') and Windows ('\\') separators so the version + // is detected regardless of the OS the docs are built on + const parts = pathname.split(/[/\\]/); const websiteIndex = parts.lastIndexOf('website'); if (websiteIndex === -1 || websiteIndex + 1 >= parts.length) return '';