This is an automated email from the ASF dual-hosted git repository.
urfree 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 c888474 update
c888474 is described below
commit c888474730429e62f92205889532786ebd6aa15c
Author: LiLi <[email protected]>
AuthorDate: Thu Feb 24 10:56:29 2022 +0800
update
Signed-off-by: LiLi <[email protected]>
---
site2/website-next/docusaurus.config.js | 52 +++++++++++-----------
site2/website-next/src/theme/Navbar/index.js | 23 +++++++---
.../src/theme/NavbarItem/DefaultNavbarItem.js | 12 +++++
site2/website-next/versions.json | 2 +-
4 files changed, 56 insertions(+), 33 deletions(-)
diff --git a/site2/website-next/docusaurus.config.js
b/site2/website-next/docusaurus.config.js
index 1384fca..7a511a5 100644
--- a/site2/website-next/docusaurus.config.js
+++ b/site2/website-next/docusaurus.config.js
@@ -132,7 +132,7 @@ module.exports = {
},
{
label: "Ecosystem",
- to: "ecosystem",
+ to: "/ecosystem",
},
// ... more items
],
@@ -197,23 +197,23 @@ module.exports = {
position: "right",
items: [
{
- to: "community#welcome",
+ to: "/community#welcome",
label: "Welcome",
},
{
- to: "community#discussions",
+ to: "/community#discussions",
label: "Discussions",
},
{
- to: "community#governance",
+ to: "/community#governance",
label: "Governance",
},
{
- to: "community#community",
+ to: "/community#community",
label: "Meet the Community",
},
{
- to: "community#how-to-contribute",
+ to: "/community#how-to-contribute",
label: "Contribute",
},
{
@@ -232,19 +232,19 @@ module.exports = {
position: "right",
items: [
{
- to: "blog",
+ to: "/blog",
label: "Blog",
},
{
- to: "case-studies",
+ to: "/case-studies",
label: "Case Studies",
},
{
- to: "resources",
+ to: "/resources",
label: "Resources",
},
{
- to: "events",
+ to: "/events",
label: "Events",
},
],
@@ -255,68 +255,68 @@ module.exports = {
},
{
label: "Version",
- to: "docs",
+ to: "/docs",
position: "right",
items: [
{
label: "2.9.1",
- to: "docs/",
+ to: "/docs/",
},
{
label: "2.9.0",
- to: "docs/2.9.0/",
+ to: "/docs/2.9.0/",
},
{
label: "2.8.2",
- to: "docs/2.8.2/",
+ to: "/docs/2.8.2/",
},
{
label: "2.8.1",
- to: "docs/2.8.1/",
+ to: "/docs/2.8.1/",
},
{
label: "2.8.0",
- to: "docs/2.8.0/",
+ to: "/docs/2.8.0/",
},
{
label: "2.7.3",
- to: "docs/2.7.3/",
+ to: "/docs/2.7.3/",
},
{
label: "2.7.2",
- to: "docs/2.7.2/",
+ to: "/docs/2.7.2/",
},
{
label: "2.7.1",
- to: "docs/2.7.1/",
+ to: "/docs/2.7.1/",
},
{
label: "2.7.0",
- to: "docs/2.7.0/",
+ to: "/docs/2.7.0/",
},
{
label: "2.6.4",
- to: "docs/2.6.4/",
+ to: "/docs/2.6.4/",
},
{
label: "2.6.3",
- to: "docs/2.6.3/",
+ to: "/docs/2.6.3/",
},
{
label: "2.6.2",
- to: "docs/2.6.2/",
+ to: "/docs/2.6.2/",
},
{
label: "2.6.1",
- to: "docs/2.6.1/",
+ to: "/docs/2.6.1/",
},
{
label: "2.6.0",
- to: "docs/2.6.0/",
+ to: "/docs/2.6.0/",
},
{
label: "2.2.0",
- to: "docs/2.2.0/",
+ to: "/docs/2.2.0/",
},
],
},
diff --git a/site2/website-next/src/theme/Navbar/index.js
b/site2/website-next/src/theme/Navbar/index.js
index 3759d4c..3b4dddf 100644
--- a/site2/website-next/src/theme/Navbar/index.js
+++ b/site2/website-next/src/theme/Navbar/index.js
@@ -25,6 +25,8 @@ import Logo from "@theme/Logo";
import IconMenu from "@theme/IconMenu";
import IconClose from "@theme/IconClose";
import styles from "./styles.module.css"; // retrocompatible with v1
+import BrowserOnly from "@docusaurus/BrowserOnly";
+import useIsBrowser from "@docusaurus/useIsBrowser";
import {
latestStableVersion,
setVersion,
@@ -271,6 +273,7 @@ function Navbar() {
const items = useNavbarItems();
const hasSearchNavbarItem = items.some((item) => item.type === "search");
const { leftItems, rightItems } = splitNavItemsByPosition(items);
+ const isBrowser = useIsBrowser();
return (
<nav
ref={navbarRef}
@@ -304,9 +307,13 @@ function Navbar() {
setVersion(latestStableVersion);
}}
/>
- {/* <a className="font-bold underline mr-4 -ml-4" href="/versions/">
- {getVersion() == "master" ? "next" : getVersion()}
- </a> */}
+ <BrowserOnly>
+ {() => (
+ <a className="font-bold underline mr-4 -ml-4" href="/versions/">
+ {getVersion() == "master" ? "next" : getVersion()}
+ </a>
+ )}
+ </BrowserOnly>
{leftItems.map((item, i) => {
if (item.label == "REST APIs") {
item.items = item.items.map((e) => {
@@ -354,17 +361,21 @@ function Navbar() {
</div>
<div className="navbar__items navbar__items--right">
{rightItems.map((item, i) => {
- if (item.label == "Previous Versions") {
+ if (item.label && item.label.toLocaleLowerCase() == "version") {
item.items = item.items.map((e) => {
return {
...e,
+ custom: e.to,
onClick: () => {
- if (/(\d\.)+/.test(e.to)) {
- let version = e.to.substring(5, e.to.length - 1);
+ if (/(\d\.?)+/.test(e.to)) {
+ let version = /((\d\.?)+)/.exec(e.to)[1];
setVersion(version);
} else {
setVersion(latestStableVersion);
}
+ if (isBrowser) {
+ window.open(e.to, "_self");
+ }
},
};
});
diff --git a/site2/website-next/src/theme/NavbarItem/DefaultNavbarItem.js
b/site2/website-next/src/theme/NavbarItem/DefaultNavbarItem.js
index 709c1f6..29714f5 100644
--- a/site2/website-next/src/theme/NavbarItem/DefaultNavbarItem.js
+++ b/site2/website-next/src/theme/NavbarItem/DefaultNavbarItem.js
@@ -19,6 +19,7 @@ export function NavLink({
to,
href,
link,
+ custom,
label,
activeClassName = "",
prependBaseUrlToHref,
@@ -40,6 +41,17 @@ export function NavLink({
</a>
);
}
+ if (custom) {
+ return (
+ <a
+ rel="noopener noreferrer"
+ className="dropdown__link cursor-pointer"
+ {...props}
+ >
+ <span>{label}</span>
+ </a>
+ );
+ }
return (
<Link
{...(href
diff --git a/site2/website-next/versions.json b/site2/website-next/versions.json
index 3c22abe..f829e1e 100644
--- a/site2/website-next/versions.json
+++ b/site2/website-next/versions.json
@@ -1 +1 @@
-["2.9.1", "2.9.0"]
+["2.9.1"]