Skip to content

Commit 370fe0f

Browse files
committed
fix compilation bugs
1 parent 01598e3 commit 370fe0f

File tree

3 files changed

+31
-41
lines changed

3 files changed

+31
-41
lines changed

docusaurus.config.ts

+2-29
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
import { themes as prismThemes } from "prism-react-renderer";
22
import type { Config } from "@docusaurus/types";
33
import type * as Preset from "@docusaurus/preset-classic";
4-
import path from "path";
5-
6-
const url = process.env.URL ?? "http://localhost";
7-
const yfnUrl = process.env.YFN_URL ?? "https://youngfounders.network";
8-
const baseUrl = process.env.BASE_URL ?? "/roadmap";
9-
const githubUrl = "https://github.com/yfndev/yfn-roadmap";
4+
import { baseUrl, githubUrl, url, yfnUrl } from "./src/constants";
105

116
const config: Config = {
127
title: "Roadmap",
@@ -83,41 +78,19 @@ const config: Config = {
8378
footer: {
8479
style: "dark",
8580
links: [
86-
{
87-
title: "Docs",
88-
items: [
89-
{
90-
label: "Startup Basics",
91-
to: "/docs/startup-basics/intro",
92-
},
93-
],
94-
},
9581
{
9682
title: "Legal",
9783
items: [
9884
{
9985
label: "Impressum",
100-
href: process.env.YFN_URL ?? "/imprint",
86+
href: yfnUrl ?? "/imprint",
10187
},
10288
{
10389
label: "Datenschutz",
10490
href: yfnUrl + "/legal/privacy",
10591
},
10692
],
10793
},
108-
{
109-
title: "Links",
110-
items: [
111-
{
112-
label: "YFN Website",
113-
href: yfnUrl,
114-
},
115-
{
116-
label: "GitHub",
117-
href: githubUrl,
118-
},
119-
],
120-
},
12194
],
12295
copyright: `Copyright © ${new Date().getFullYear()} Young Founders Network e.V.`,
12396
},

src/constants.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
function getEnv(key: string): string | undefined {
2+
const value = process.env[key];
3+
// if is empty, return undefined
4+
if (value === "") {
5+
return undefined;
6+
}
7+
return value;
8+
}
9+
10+
const url = getEnv("URL") ?? "http://localhost";
11+
const yfnUrl = getEnv("YFN_URL") ?? "https://youngfounders.network";
12+
const baseUrl = getEnv("BASE_URL") ?? "/roadmap";
13+
const githubUrl = "https://github.com/yfndev/yfn-roadmap";
14+
15+
export { url, yfnUrl, baseUrl, githubUrl };

src/pages/index.tsx

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import clsx from 'clsx';
2-
import Link from '@docusaurus/Link';
3-
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
4-
import Layout from '@theme/Layout';
5-
import HomepageFeatures from '@site/src/components/HomepageFeatures';
6-
import Heading from '@theme/Heading';
1+
import clsx from "clsx";
2+
import Link from "@docusaurus/Link";
3+
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
4+
import Layout from "@theme/Layout";
5+
import HomepageFeatures from "@site/src/components/HomepageFeatures";
6+
import Heading from "@theme/Heading";
77

8-
import styles from './index.module.css';
8+
import styles from "./index.module.css";
99

1010
function HomepageHeader() {
11-
const {siteConfig} = useDocusaurusContext();
11+
const { siteConfig } = useDocusaurusContext();
1212
return (
13-
<header className={clsx('hero hero--primary', styles.heroBanner)}>
13+
<header className={clsx("hero hero--primary", styles.heroBanner)}>
1414
<div className="container">
1515
<Heading as="h1" className="hero__title">
1616
{siteConfig.title}
@@ -19,7 +19,8 @@ function HomepageHeader() {
1919
<div className={styles.buttons}>
2020
<Link
2121
className="button button--secondary button--lg"
22-
to="/docs/intro">
22+
to="/docs/startup-basics/intro"
23+
>
2324
Docusaurus Tutorial - 5min ⏱️
2425
</Link>
2526
</div>
@@ -29,11 +30,12 @@ function HomepageHeader() {
2930
}
3031

3132
export default function Home(): JSX.Element {
32-
const {siteConfig} = useDocusaurusContext();
33+
const { siteConfig } = useDocusaurusContext();
3334
return (
3435
<Layout
3536
title={`Hello from ${siteConfig.title}`}
36-
description="Description will go into a meta tag in <head />">
37+
description="Description will go into a meta tag in <head />"
38+
>
3739
<HomepageHeader />
3840
<main>
3941
<HomepageFeatures />

0 commit comments

Comments
 (0)