This is an automated email from the ASF dual-hosted git repository.
juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git
The following commit(s) were added to refs/heads/master by this push:
new 90a973f231d feat: replace locale dropdown with blog link (#1213)
90a973f231d is described below
commit 90a973f231d3266af9abbc8ba1f207e861ff51b7
Author: Young <[email protected]>
AuthorDate: Sat Jul 16 11:50:53 2022 +0800
feat: replace locale dropdown with blog link (#1213)
---
website/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/website/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx
b/website/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx
index ad0646727a2..7fc1f041028 100644
--- a/website/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx
+++ b/website/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx
@@ -14,6 +14,7 @@ import useDocusaurusContext from
'@docusaurus/useDocusaurusContext';
// eslint-disable-next-line import/no-extraneous-dependencies
import { useAlternatePageUtils } from '@docusaurus/theme-common';
import { useLocation } from '@docusaurus/router';
+import Link from '@docusaurus/Link';
import styles from './styles.module.css';
interface LocaleDropdownNavbarItemProps extends Omit<Props, 'items'>{
@@ -34,8 +35,12 @@ const LocaleDropdownNavbarItem:
FC<LocaleDropdownNavbarItemProps> = (props) => {
const alternatePageUtils = useAlternatePageUtils();
const { pathname } = useLocation();
- if (pathname.startsWith('/zh/blog') || pathname.startsWith('/blog')) {
- return null;
+ if (pathname.startsWith('/zh/blog')) {
+ return <Link isNavLink autoAddBaseUrl={false} to="pathname:///blog"
target="_self">English Blog</Link>;
+ }
+
+ if (pathname.startsWith('/blog')) {
+ return <Link isNavLink autoAddBaseUrl={false} to="pathname:///zh/blog"
target="_self">中文博客</Link>;
}
function getLocaleLabel(locale) {