diff --git a/website/src/components/HomepageFeatures/index.tsx b/website/src/components/HomepageFeatures/index.tsx index 2a72653..9bd74fe 100644 --- a/website/src/components/HomepageFeatures/index.tsx +++ b/website/src/components/HomepageFeatures/index.tsx @@ -2,6 +2,7 @@ import type { ReactNode } from "react"; import clsx from "clsx"; import Heading from "@theme/Heading"; import styles from "./styles.module.css"; +import { useGenerateSiteUrl } from "@site/src/hooks"; type FeatureItem = { title: string; @@ -16,9 +17,8 @@ const FeatureList: FeatureItem[] = [ imgSrc: require("@site/static/img/files-toml.png").default, description: ( <> - Create your own channels in a simple TOML file and search through - files, git repositories, environment variables, docker images, and - more. + Create your own channels in a simple TOML file and search through files, + git repositories, environment variables, docker images, and more. ), link: "/docs/Users/channels", @@ -37,6 +37,8 @@ const FeatureList: FeatureItem[] = [ ]; function Feature({ title, imgSrc, description, link }: FeatureItem) { + const generateSiteUrl = useGenerateSiteUrl(); + return (
- {title} + + {title} +

{description}

diff --git a/website/src/hooks/index.ts b/website/src/hooks/index.ts new file mode 100644 index 0000000..97552ef --- /dev/null +++ b/website/src/hooks/index.ts @@ -0,0 +1 @@ +export * from "./useGenerateSiteUrl"; diff --git a/website/src/hooks/useGenerateSiteUrl.ts b/website/src/hooks/useGenerateSiteUrl.ts new file mode 100644 index 0000000..021cf17 --- /dev/null +++ b/website/src/hooks/useGenerateSiteUrl.ts @@ -0,0 +1,11 @@ +import useDocusaurusContext from "@docusaurus/useDocusaurusContext"; + +export const useGenerateSiteUrl = () => { + const { siteConfig } = useDocusaurusContext(); + + return (path: string) => { + return `${siteConfig.baseUrl}${ + path.startsWith("/") ? path.slice(1) : path + }`; + }; +};