From e3385414a31b9a0a325803614f03d1b36fbfdafe Mon Sep 17 00:00:00 2001 From: AruSeito Date: Thu, 4 Jan 2024 01:04:27 +0800 Subject: [PATCH] fix: path --- src/ILLATheme/CommonFooter/constants.tsx | 4 ++-- src/ILLATheme/CommonFooter/index.tsx | 3 ++- src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx | 3 ++- src/ILLATheme/CommonHeader/SolutionsItem/index.tsx | 3 ++- .../LandingLayout/ResourceTemplateLayout/index.tsx | 3 ++- src/components/blog/FeaturedBlogPostItem/index.js | 10 ++++++---- src/components/blog/PostPage/index.js | 13 ++++++++----- src/components/blog/PostPaginator/index.js | 3 ++- src/components/blog/Tags/index.js | 3 ++- src/components/landingPage/IndexContent/index.tsx | 3 ++- src/theme/BlogPostItem/index.js | 8 +++++--- .../NavbarItem/LocaleDropdownNavbarItem/index.js | 2 +- src/utils/fixedPath.ts | 1 + 13 files changed, 37 insertions(+), 22 deletions(-) create mode 100644 src/utils/fixedPath.ts diff --git a/src/ILLATheme/CommonFooter/constants.tsx b/src/ILLATheme/CommonFooter/constants.tsx index 675c15618b..497d85bdf2 100644 --- a/src/ILLATheme/CommonFooter/constants.tsx +++ b/src/ILLATheme/CommonFooter/constants.tsx @@ -33,7 +33,7 @@ export const Community: IFootContentItem[] = [ }, { icon: , - href: "https://www.linkedin.com/company/illacloud/", + href: "https://www.linkedin.com/company/illacloud", tagCategory: "homepage_footer_linkedin_click", label: "LinkedIn", }, @@ -45,7 +45,7 @@ const AboutUs: IFootContentItem[] = [ message: "Status", id: "footer.status", }), - href: "https://status.illacloud.com/", + href: "https://status.illacloud.com", tagCategory: "homepage_footer_status_click", }, { diff --git a/src/ILLATheme/CommonFooter/index.tsx b/src/ILLATheme/CommonFooter/index.tsx index 38cfefc4e5..1213921983 100644 --- a/src/ILLATheme/CommonFooter/index.tsx +++ b/src/ILLATheme/CommonFooter/index.tsx @@ -15,6 +15,7 @@ import Translate, { translate } from "@docusaurus/Translate" import { ICommonFooterProps } from "./interface" import { useUtmParams } from "@site/src/hooks/useUtmParams" import { POLICY, SERVICE } from "@site/src/constants/url" +import { fixedPath } from "@site/src/utils/fixedPath" const CommonFooter: FC = ({ whiteTheme = false, @@ -89,7 +90,7 @@ const CommonFooter: FC = ({ return ( {icon ? ( diff --git a/src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx b/src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx index 7f44d8c032..b62ebcd26c 100644 --- a/src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx +++ b/src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx @@ -3,11 +3,12 @@ import Link from "@docusaurus/Link" import { IMenuItemProps } from "../interface" import style from "./index.module.css" import { sendTagEvent } from "@site/src/utils/gtag" +import { fixedPath } from "@site/src/utils/fixedPath" export const MenuItem: React.FC = ({ item }) => { return ( { sendTagEvent({ diff --git a/src/ILLATheme/CommonHeader/SolutionsItem/index.tsx b/src/ILLATheme/CommonHeader/SolutionsItem/index.tsx index 868f2f8884..04404a8e8c 100644 --- a/src/ILLATheme/CommonHeader/SolutionsItem/index.tsx +++ b/src/ILLATheme/CommonHeader/SolutionsItem/index.tsx @@ -7,6 +7,7 @@ import clsx from "clsx" import { sendTagEvent } from "@site/src/utils/gtag" import { useUtmParams } from "@site/src/hooks/useUtmParams" import style from "./index.module.css" +import { fixedPath } from "@site/src/utils/fixedPath" export const Solutions: FC<{ whiteTheme: boolean }> = ({ whiteTheme }) => { const getUtmParams = useUtmParams() @@ -59,7 +60,7 @@ export const Solutions: FC<{ whiteTheme: boolean }> = ({ whiteTheme }) => { {() => ( = (props) => { const { title, description, headerConfig, footerConfig, schemaData } = props @@ -26,7 +27,7 @@ const ResourceTemplateLayout: FC = (props) => { leftImage={headerConfig.leftImage} isShowBack={headerConfig.isShowBack} backText={headerConfig.backText} - prevPagePath={headerConfig.prevPagePath} + prevPagePath={fixedPath(headerConfig.prevPagePath)} /> diff --git a/src/components/blog/FeaturedBlogPostItem/index.js b/src/components/blog/FeaturedBlogPostItem/index.js index eb46904cbe..a8fb4985c5 100644 --- a/src/components/blog/FeaturedBlogPostItem/index.js +++ b/src/components/blog/FeaturedBlogPostItem/index.js @@ -3,9 +3,9 @@ import Link from "@docusaurus/Link" import { useBlogPost } from "@docusaurus/theme-common/internal" import BlogPostItemContainer from "@theme/BlogPostItem/Container" import { useUtmParams } from "@site/src/hooks/useUtmParams" - import { Date } from "@site/src/components/blog/common/date" import clsx from "clsx" +import { fixedPath } from "@site/src/utils/fixedPath" export const FeaturedBlogPostItem = () => { const { metadata } = useBlogPost() @@ -22,9 +22,11 @@ export const FeaturedBlogPostItem = () => { const author = metadata.authors[0] const getUtmParams = useUtmParams() + const fixedPermalink = fixedPath(permalink) + return ( - +
{ "rounded", "px-2 py-1", )} - href={getUtmParams(tag.permalink)} + href={getUtmParams(fixedPath(tag.permalink))} key={tag.permalink} > {tag.label} @@ -61,7 +63,7 @@ export const FeaturedBlogPostItem = () => {
diff --git a/src/components/blog/PostPage/index.js b/src/components/blog/PostPage/index.js index c972fbff12..0da9b976bf 100644 --- a/src/components/blog/PostPage/index.js +++ b/src/components/blog/PostPage/index.js @@ -18,6 +18,7 @@ import { Date } from "@site/src/components/blog/common/date" import { ReadingTime } from "@site/src/components/blog/common/reading-time" import { useUtmParams } from "@site/src/hooks/useUtmParams" import DiscordAndGithubBanner from "@site/src/components/blog/discord-and-github-banner" +import { fixedPath } from "@site/src/utils/fixedPath" export const BlogPostPageView = ({ children }) => { const { metadata, isBlogPostPage } = useBlogPost() @@ -35,6 +36,8 @@ export const BlogPostPageView = ({ children }) => { const author = authors[0] const getUtmParams = useUtmParams() + const fixedPermalink = fixedPath(permalink) + const { siteConfig: { url }, } = useDocusaurusContext() @@ -62,7 +65,7 @@ export const BlogPostPageView = ({ children }) => { )} > ← Back to blog @@ -72,7 +75,7 @@ export const BlogPostPageView = ({ children }) => { tag.label)} @@ -83,13 +86,13 @@ export const BlogPostPageView = ({ children }) => { className="flex" windowWidth={750} windowHeight={600} - url={url + permalink} + url={url + fixedPermalink} title={title} > { {isBlogPostPage ? ( title ) : ( - + {title} )} diff --git a/src/components/blog/PostPaginator/index.js b/src/components/blog/PostPaginator/index.js index b882bc9575..75c1832b98 100644 --- a/src/components/blog/PostPaginator/index.js +++ b/src/components/blog/PostPaginator/index.js @@ -3,6 +3,7 @@ import Link from "@docusaurus/Link" import { useUtmParams } from "@site/src/hooks/useUtmParams" import { Date } from "@site/src/components/blog/common/date" import clsx from "clsx" +import { fixedPath } from "@site/src/utils/fixedPath" export const PostPaginator = ({ posts, title }) => { const getUtmParams = useUtmParams() @@ -39,7 +40,7 @@ export const PostPaginator = ({ posts, title }) => { )} > { const { metadata } = useBlogPost() @@ -11,7 +12,7 @@ export const Tags = () => {
{metadata.tags.map((tag) => ( = ({ contentList, pageName }) => { const getUtmParams = useUtmParams() @@ -51,7 +52,7 @@ const ContentItems: FC = ({ contentList, pageName }) => { {description}
onClick(name)} />
diff --git a/src/theme/BlogPostItem/index.js b/src/theme/BlogPostItem/index.js index a1f4f85aa5..c86ba7bb05 100644 --- a/src/theme/BlogPostItem/index.js +++ b/src/theme/BlogPostItem/index.js @@ -19,13 +19,15 @@ export default function BlogPostItem({ className }) { tags, } = metadata + const fixedPermalink = `${permalink}/` + const author = metadata.authors[0] const getUtmParams = useUtmParams() return (
- +
@@ -62,7 +64,7 @@ export default function BlogPostItem({ className }) {
diff --git a/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js b/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js index f4fb7e8b65..3345b5b65e 100644 --- a/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +++ b/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js @@ -23,7 +23,7 @@ export default function LocaleDropdownNavbarItem({ const baseTo = `pathname://${alternatePageUtils.createUrl({ locale, fullyQualified: false, - })}` + })}/` // preserve ?search#hash suffix on locale switches const to = `${baseTo}${search}${hash}${queryString}` diff --git a/src/utils/fixedPath.ts b/src/utils/fixedPath.ts new file mode 100644 index 0000000000..acc8080b5e --- /dev/null +++ b/src/utils/fixedPath.ts @@ -0,0 +1 @@ +export const fixedPath = (link:string)=> `${link}/` \ No newline at end of file