diff --git a/content/pages/de/home.mdx b/content/pages/de/home.mdx new file mode 100644 index 000000000..558df3334 --- /dev/null +++ b/content/pages/de/home.mdx @@ -0,0 +1,12 @@ +--- +title: Teilen und erweitern Sie Ihr Wissen im Bereich Digital Humanities +--- + +Willkommen bei den ACDH-CH Lernressourcen. Hier finden Sie interaktives Lernmaterial, praktische +HowTo-Artikel und Best Practices Beispiele zu einem breiten Spektrum von Themen, Methoden und +Infrastrukturen aus den Digital Humanities. + +Diese Ressourcen können sowohl für das selbstgesteuerte Lernen als auch für die Lehre im +Hochschulbereich genutzt werden. Es ist Teil unserer Mission, Wissen aus der laufenden Forschung +aktiv in die breitere Digital Humanities Community zu transferieren und damit eine neue Generation +von Geisteswissenschaftlern in der Nutzung von digitalen Methoden auszubilden. diff --git a/content/pages/en/home.mdx b/content/pages/en/home.mdx new file mode 100644 index 000000000..31f6de6cc --- /dev/null +++ b/content/pages/en/home.mdx @@ -0,0 +1,15 @@ +--- +title: Share and expand your knowledge in Digital Humanities +--- + +Welcome to ACDH-CH Learning Resources. This website gathers interactive learning material, practical +HowTo articles and best practices on a wide range of Digital Humanities topics, methododologies and +infrastructures. + +These resources can be used for self-guided learning as well as for teaching in higher education. It +is part of our mission to actively transfer knowledge from ongoing research into the wider Digital +Humanities Community as well as to educate a new generation of humanities researchers with digital +methods. + +The platform is being developed in the context of the [DITAH](https://www.ditah.at/) project, funded +by the Austrian Bundesministerium für Wissenschaft, Forschung und Wirtschaft. diff --git a/content/pages/home.mdx b/content/pages/home.mdx deleted file mode 100644 index 9c09830f8..000000000 --- a/content/pages/home.mdx +++ /dev/null @@ -1,10 +0,0 @@ ---- -title: Share and expand your knowledge in Digital Humanities -subtitle: A platform for sharing and expanding your knowledge of digital research tools and methods ---- - -Welcome to ACDH-CH Learning Resources. This living space gathers interactive learning material, practical HowTo articles and best practices on a wide range of Digital Humanities topics, methododologies and infrastructures. - -These resources can be used for self-guided learning as well as for teaching in higher education. It is part of our mission to actively transfer knowledge from ongoing research into the wider Digital Humanities Community as well as to educate a new generation of humanities researchers with digital methods. - -The platform is being developed in the context of the [DITAH](https://www.ditah.at/) project, funded by the Austrian Bundesministerium für Wissenschaft, Forschung und Wirtschaft. diff --git a/src/cms/api/pages.api.ts b/src/cms/api/pages.api.ts new file mode 100644 index 000000000..0e2c5b606 --- /dev/null +++ b/src/cms/api/pages.api.ts @@ -0,0 +1,29 @@ +import { join } from "node:path"; + +import { compile } from "@mdx-js/mdx"; +import withFrontmatter from "remark-frontmatter"; +import withGitHubMarkdown from "remark-gfm"; +import withMdxFrontmatter from "remark-mdx-frontmatter"; + +import { type Locale } from "@/i18n/i18n.config"; +import withTypographicQuotesAndDashes from "@/mdx/plugins/remark-smartypants"; +import { readFile } from "@/mdx/readFile"; + +export async function getPageById(id: string, locale: Locale) { + const filePath = join(process.cwd(), "content", "pages", locale, id + ".mdx"); + const vfile = await readFile(filePath); + + const result = await compile(vfile, { + development: false, + outputFormat: "function-body", + useDynamicImport: false, + remarkPlugins: [ + withGitHubMarkdown, + withTypographicQuotesAndDashes, + withFrontmatter, + withMdxFrontmatter, + ], + }); + + return String(result); +} diff --git a/src/pages/index.page.tsx b/src/pages/index.page.tsx index 9c354fb26..fce15fda8 100644 --- a/src/pages/index.page.tsx +++ b/src/pages/index.page.tsx @@ -2,6 +2,7 @@ import { type GetStaticPropsContext, type GetStaticPropsResult } from "next"; import Link from "next/link"; import { Fragment } from "react"; +import { getPageById } from "@/cms/api/pages.api"; import { type PostPreview } from "@/cms/api/posts.api"; import { getPostPreviews } from "@/cms/api/posts.api"; import { PageContent } from "@/common/PageContent"; @@ -9,27 +10,20 @@ import { getLocale } from "@/i18n/getLocale"; import { type Dictionary } from "@/i18n/loadDictionary"; import { loadDictionary } from "@/i18n/loadDictionary"; import { useI18n } from "@/i18n/useI18n"; +import { useMdx } from "@/mdx/useMdx"; import { Metadata } from "@/metadata/Metadata"; import { useAlternateUrls } from "@/metadata/useAlternateUrls"; import { useCanonicalUrl } from "@/metadata/useCanonicalUrl"; import { routes } from "@/navigation/routes.config"; import { ResourcesList } from "@/views/ResourcesList"; -const texts = { - en: "Welcome to ACDH-CH Learning Resources. This website gathers interactive learning material, practical HowTo articles and best practices on a wide range of Digital Humanities topics, methododologies and infrastructures. These resources can be used for self-guided learning as well as for teaching in higher education. It is part of our mission to actively transfer knowledge from ongoing research into the wider Digital Humanities Community as well as to educate a new generation of humanities researchers with digital methods.", - de: "Willkommen bei den ACDH-CH Lernressourcen. Hier finden Sie interaktives Lernmaterial, praktische HowTo-Artikel und Best Practices Beispiele zu einem breiten Spektrum von Themen, Methoden und Infrastrukturen aus den Digital Humanities. Diese Ressourcen können sowohl für das selbstgesteuerte Lernen als auch für die Lehre im Hochschulbereich genutzt werden. Es ist Teil unserer Mission, Wissen aus der laufenden Forschung aktiv in die breitere Digital Humanities Community zu transferieren und damit eine neue Generation von Geisteswissenschaftlern in der Nutzung von digitalen Methoden auszubilden.", -}; - -export interface HomePageMetadata extends Record { - title: string; - subtitle: string; -} +export interface HomePageMetadata extends Record {} export interface HomePageProps { dictionary: Dictionary; locale: "de" | "en"; posts: Array; - text: string; + code: string; } /** @@ -42,14 +36,15 @@ export async function getStaticProps( const dictionary = await loadDictionary(locale, ["common"]); const posts = (await getPostPreviews(locale)).slice(0, 4); - const text = texts[locale]; + + const code = await getPageById("home", locale); return { props: { dictionary, locale, posts, - text, + code, }, }; } @@ -58,11 +53,13 @@ export async function getStaticProps( * Home page. */ export default function HomePage(props: HomePageProps): JSX.Element { - const { locale, posts, text } = props; + const { posts, code } = props; const { t } = useI18n(); const canonicalUrl = useCanonicalUrl(); const languageAlternates = useAlternateUrls(); + const { MdxContent, metadata } = useMdx(code); + const title = String(metadata?.title ?? ""); return ( @@ -75,24 +72,29 @@ export default function HomePage(props: HomePageProps): JSX.Element {

- {locale === "de" ? ( - - Teilen und{" "} - erweitern Sie Ihr Wissen im Bereich{" "} - Digital Humanities - - ) : ( - - Share and{" "} - expand your knowledge in{" "} - Digital Humanities - - )} + {title.split(" ").map((segment, index) => { + const className = + index === 0 + ? "text-brand-light-blue" + : index === 2 + ? "text-brand-light-blue" + : index === segment.length - 2 + ? "text-brand-turquoise" + : index === segment.length - 1 + ? "text-brand-turquoise" + : undefined; + + return ( + + {segment}{" "} + + ); + })}

-
- {text} +
+