You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2022/06/28 02:59:04 UTC
[pulsar-site] branch main updated: Fix versioned links (#124)
This is an automated email from the ASF dual-hosted git repository.
mmarshall pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push:
new feb9cee5520 Fix versioned links (#124)
feb9cee5520 is described below
commit feb9cee5520ae79b3acc4af4670f143df1f653bf
Author: Michael Marshall <mm...@apache.org>
AuthorDate: Mon Jun 27 21:58:59 2022 -0500
Fix versioned links (#124)
Fixes https://github.com/apache/pulsar/issues/15984.
## Motivation
We have many versioned links in our docs. We replace those links by running `node replace.js` on the script I update in this PR. The versioning is currently broken.
## Change
* Fix the `clientVersionUrl` method in the `website-next/scripts/replace.js` file. Note that this changes the method so that it matches the `website/scripts/replace.js`.
---
site2/website-next/scripts/replace.js | 26 ++++++++------------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/site2/website-next/scripts/replace.js b/site2/website-next/scripts/replace.js
index bd1dec11e24..3098156be75 100644
--- a/site2/website-next/scripts/replace.js
+++ b/site2/website-next/scripts/replace.js
@@ -91,24 +91,14 @@ function debDistUrl(version, type) {
}
function clientVersionUrl(version, type) {
- return `${siteConfig.url}/api/${type}`;
- // var versions = version.split(".");
- // var majorVersion = parseInt(versions[0]);
- // var minorVersion = parseInt(versions[1]);
- // if (majorVersion === 2 && minorVersion < 5) {
- // return `${siteConfig.url}/api/` + type + `/` + version + "/";
- // } else if (majorVersion >= 2 && minorVersion >= 5) {
- // return (
- // `${siteConfig.url}/api/` +
- // type +
- // `/` +
- // majorVersion +
- // `.` +
- // minorVersion +
- // `.0` +
- // `-SNAPSHOT/`
- // );
- // }
+ var versions = version.split('.')
+ var majorVersion = parseInt(versions[0])
+ var minorVersion = parseInt(versions[1])
+ if ((majorVersion === 2 && minorVersion < 5) || (type === "python" && minorVersion >= 7)) {
+ return `${siteConfig.url}/api/${type}/${version}`;
+ } else if (majorVersion >= 2 && minorVersion >= 5) {
+ return `${siteConfig.url}/api/${type}/${majorVersion}.${minorVersion}.0-SNAPSHOT/`
+ }
}
function doReplace(options) {