Skip to content

Commit

Permalink
fix: path
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito authored Jan 3, 2024
1 parent e5d991d commit e338541
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/ILLATheme/CommonFooter/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const Community: IFootContentItem[] = [
},
{
icon: <LinkedInIcon />,
href: "https://www.linkedin.com/company/illacloud/",
href: "https://www.linkedin.com/company/illacloud",
tagCategory: "homepage_footer_linkedin_click",
label: "LinkedIn",
},
Expand All @@ -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",
},
{
Expand Down
3 changes: 2 additions & 1 deletion src/ILLATheme/CommonFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<ICommonFooterProps> = ({
whiteTheme = false,
Expand Down Expand Up @@ -89,7 +90,7 @@ const CommonFooter: FC<ICommonFooterProps> = ({
return (
<Link
key={label}
to={getUtmParams(href)}
to={getUtmParams(fixedPath(href))}
className="hover:no-underline"
>
{icon ? (
Expand Down
3 changes: 2 additions & 1 deletion src/ILLATheme/CommonHeader/MobileMenu/menuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<IMenuItemProps> = ({ item }) => {
return (
<Link
to={item.href}
to={fixedPath(item.href)}
className={style.menuItemStyle}
onClick={() => {
sendTagEvent({
Expand Down
3 changes: 2 additions & 1 deletion src/ILLATheme/CommonHeader/SolutionsItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -59,7 +60,7 @@ export const Solutions: FC<{ whiteTheme: boolean }> = ({ whiteTheme }) => {
<Menu.Item key={subItem.label}>
{() => (
<Link
to={getUtmParams(subItem.href)}
to={getUtmParams(fixedPath(subItem.href))}
className={clsx(
style.basePanelItemContainerStyle,
whiteTheme
Expand Down
3 changes: 2 additions & 1 deletion src/ILLATheme/LandingLayout/ResourceTemplateLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { LpHeader } from "../../../components/landingPage/Header"
import styles from "./style.module.css"
import CommBottom from "../../../components/common/CommBottom"
import { LpTemplate } from "../../../components/landingPage/Template"
import { fixedPath } from "@site/src/utils/fixedPath"

const ResourceTemplateLayout: FC<IResourceTemplateLayoutProps> = (props) => {
const { title, description, headerConfig, footerConfig, schemaData } = props
Expand All @@ -26,7 +27,7 @@ const ResourceTemplateLayout: FC<IResourceTemplateLayoutProps> = (props) => {
leftImage={headerConfig.leftImage}
isShowBack={headerConfig.isShowBack}
backText={headerConfig.backText}
prevPagePath={headerConfig.prevPagePath}
prevPagePath={fixedPath(headerConfig.prevPagePath)}
/>
<LpTemplate />
</div>
Expand Down
10 changes: 6 additions & 4 deletions src/components/blog/FeaturedBlogPostItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -22,9 +22,11 @@ export const FeaturedBlogPostItem = () => {
const author = metadata.authors[0]
const getUtmParams = useUtmParams()

const fixedPermalink = fixedPath(permalink)

return (
<BlogPostItemContainer>
<Link itemProp="url" to={getUtmParams(permalink)}>
<Link itemProp="url" to={getUtmParams(fixedPermalink)}>
<div className="not-prose relative m-0 h-40 hover:brightness-90 md:h-64">
<img
src={`${frontMatter.image}?h=256`}
Expand All @@ -51,7 +53,7 @@ export const FeaturedBlogPostItem = () => {
"rounded",
"px-2 py-1",
)}
href={getUtmParams(tag.permalink)}
href={getUtmParams(fixedPath(tag.permalink))}
key={tag.permalink}
>
{tag.label}
Expand All @@ -61,7 +63,7 @@ export const FeaturedBlogPostItem = () => {
<div className="mb-2 md:mb-4 2xl:mb-6">
<Link
itemProp="url"
to={getUtmParams(permalink)}
to={getUtmParams(fixedPermalink)}
className="no-underline hover:no-underline"
rel="noopener dofollow"
>
Expand Down
13 changes: 8 additions & 5 deletions src/components/blog/PostPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -35,6 +36,8 @@ export const BlogPostPageView = ({ children }) => {
const author = authors[0]
const getUtmParams = useUtmParams()

const fixedPermalink = fixedPath(permalink)

const {
siteConfig: { url },
} = useDocusaurusContext()
Expand Down Expand Up @@ -62,7 +65,7 @@ export const BlogPostPageView = ({ children }) => {
)}
>
<Link
to={getUtmParams("/blog")}
to={getUtmParams("/blog/")}
className={clsx("!text-white-04 text-sm no-underline")}
>
← Back to blog
Expand All @@ -72,7 +75,7 @@ export const BlogPostPageView = ({ children }) => {
<TwitterShareButton
windowWidth={750}
windowHeight={800}
url={url + permalink}
url={url + fixedPermalink}
className="flex"
title={title}
hashtags={tags.map((tag) => tag.label)}
Expand All @@ -83,13 +86,13 @@ export const BlogPostPageView = ({ children }) => {
className="flex"
windowWidth={750}
windowHeight={600}
url={url + permalink}
url={url + fixedPermalink}
title={title}
>
<RedditIcon size={26} round />
</RedditShareButton>
<LinkedinShareButton
url={url + permalink}
url={url + fixedPermalink}
title={title}
source={url}
summary={description}
Expand Down Expand Up @@ -130,7 +133,7 @@ export const BlogPostPageView = ({ children }) => {
{isBlogPostPage ? (
title
) : (
<Link itemProp="url" to={getUtmParams(permalink)}>
<Link itemProp="url" to={getUtmParams(fixedPermalink)}>
{title}
</Link>
)}
Expand Down
3 changes: 2 additions & 1 deletion src/components/blog/PostPaginator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -39,7 +40,7 @@ export const PostPaginator = ({ posts, title }) => {
)}
>
<Link
to={getUtmParams(post.permalink)}
to={getUtmParams(fixedPath(post.permalink))}
rel="dofollow"
className={clsx(
"font-bold",
Expand Down
3 changes: 2 additions & 1 deletion src/components/blog/Tags/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from "@docusaurus/Link"
import { useBlogPost } from "@docusaurus/theme-common/internal"
import clsx from "clsx"
import { useUtmParams } from "@site/src/hooks/useUtmParams"
import { fixedPath } from "@site/src/utils/fixedPath"

export const Tags = () => {
const { metadata } = useBlogPost()
Expand All @@ -11,7 +12,7 @@ export const Tags = () => {
<div className="flex flex-wrap gap-2 pb-6 pl-1">
{metadata.tags.map((tag) => (
<Link
to={getUtmParams(tag.permalink)}
to={getUtmParams(fixedPath(tag.permalink))}
className={clsx(
"text-xs",
"bg-gray-100 dark:bg-gray-700",
Expand Down
3 changes: 2 additions & 1 deletion src/components/landingPage/IndexContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import clsx from "clsx"
import { IContentItemsProps, IIndexContentProps } from "./interface"
import { LearnMore } from "../LearnMore"
import { useUtmParams } from "@site/src/hooks/useUtmParams"
import { fixedPath } from "@site/src/utils/fixedPath"

const ContentItems: FC<IContentItemsProps> = ({ contentList, pageName }) => {
const getUtmParams = useUtmParams()
Expand Down Expand Up @@ -51,7 +52,7 @@ const ContentItems: FC<IContentItemsProps> = ({ contentList, pageName }) => {
<span className={styles.itemDescription}>{description}</span>
</div>
<LearnMore
href={getUtmParams(`/${pageName}/${path}`)}
href={getUtmParams(fixedPath(`/${pageName}/${path}`))}
onClick={() => onClick(name)}
/>
</div>
Expand Down
8 changes: 5 additions & 3 deletions src/theme/BlogPostItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ export default function BlogPostItem({ className }) {
tags,
} = metadata

const fixedPermalink = `${permalink}/`

const author = metadata.authors[0]
const getUtmParams = useUtmParams()

return (
<BlogPostItemContainer className={className}>
<div>
<Link itemProp="url" to={getUtmParams(permalink)}>
<Link itemProp="url" to={getUtmParams(fixedPermalink)}>
<div className="not-prose relative m-0 h-40 hover:brightness-90">
<img
src={`${frontMatter.image}?h=160`}
Expand Down Expand Up @@ -53,7 +55,7 @@ export default function BlogPostItem({ className }) {
"rounded",
"px-2 py-1",
)}
permalink={tag.permalink}
permalink={tag.fixedPermalink}
key={tag.permalink}
label={tag.label}
/>
Expand All @@ -62,7 +64,7 @@ export default function BlogPostItem({ className }) {
<div className="mb-2 md:mb-4">
<Link
itemProp="url"
to={permalink}
to={fixedPermalink}
className="no-underline hover:no-underline"
rel="noopener dofollow"
>
Expand Down
2 changes: 1 addition & 1 deletion src/theme/NavbarItem/LocaleDropdownNavbarItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand Down
1 change: 1 addition & 0 deletions src/utils/fixedPath.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const fixedPath = (link:string)=> `${link}/`

0 comments on commit e338541

Please sign in to comment.