You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ur...@apache.org on 2022/09/30 01:58:35 UTC

[pulsar-site] branch remove-release-notes-banner created (now 27c76594425)

This is an automated email from the ASF dual-hosted git repository.

urfree pushed a change to branch remove-release-notes-banner
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


      at 27c76594425 hide top banner on non-docs page

This branch includes the following new commits:

     new 27c76594425 hide top banner on non-docs page

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[pulsar-site] 01/01: hide top banner on non-docs page

Posted by ur...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

urfree pushed a commit to branch remove-release-notes-banner
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git

commit 27c765944250b48bbf0555ac560a8d5ab1c1a528
Author: Li Li <ur...@apache.org>
AuthorDate: Fri Sep 30 09:58:22 2022 +0800

    hide top banner on non-docs page
    
    Signed-off-by: Li Li <ur...@apache.org>
---
 .../src/theme/DocVersionBanner/index.js            | 31 +++++++++++++---------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/site2/website-next/src/theme/DocVersionBanner/index.js b/site2/website-next/src/theme/DocVersionBanner/index.js
index 1cc22a656ac..4bff992818a 100644
--- a/site2/website-next/src/theme/DocVersionBanner/index.js
+++ b/site2/website-next/src/theme/DocVersionBanner/index.js
@@ -12,6 +12,7 @@ import {
   useDocsPreferredVersion,
   useDocsVersion,
 } from "@docusaurus/theme-common/internal";
+import BrowserOnly from "@docusaurus/BrowserOnly";
 let versions = require("../../../versions.json");
 const _latestVersion = versions[0];
 const _maintainedVersions = [versions[1], versions[2]];
@@ -100,9 +101,7 @@ function LatestVersionSuggestionLabel({ versionLabel, to, onClick }) {
         ),
       }}
     >
-      {
-        "We recommend you use the {latestVersionLink} ({versionLabel})."
-      }
+      {"We recommend you use the {latestVersionLink} ({versionLabel})."}
     </Translate>
   );
 }
@@ -152,13 +151,21 @@ function DocVersionBannerEnabled({ className, versionMetadata }) {
 }
 export default function DocVersionBanner({ className }) {
   const versionMetadata = useDocsVersion();
-  if (versionMetadata.version != _latestVersion) {
-    return (
-      <DocVersionBannerEnabled
-        className={className}
-        versionMetadata={versionMetadata}
-      />
-    );
-  }
-  return null;
+  console.log("...", versionMetadata.version, _latestVersion);
+  return (
+    <BrowserOnly>
+      {() => {
+        console.log("...", location.pathname.startsWith("/docs"));
+        return versionMetadata.version != _latestVersion &&
+          location.pathname.startsWith("/docs") ? (
+          <DocVersionBannerEnabled
+            className={className}
+            versionMetadata={versionMetadata}
+          />
+        ) : (
+          <></>
+        );
+      }}
+    </BrowserOnly>
+  );
 }