From b74ff28b354cf08206f46aa60ff514fb12e69528 Mon Sep 17 00:00:00 2001 From: Alfie Jones <alfie.jones@hotmail.co.uk> Date: Mon, 10 Jun 2024 16:41:17 +0100 Subject: [PATCH] adding title and descriptions --- apps/marketing-astro/package.json | 1 + apps/marketing-astro/src/pages/docs/[...path].astro | 13 +++++++++++-- pnpm-lock.yaml | 3 +++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/marketing-astro/package.json b/apps/marketing-astro/package.json index 9cd5ee4b..a8a9c539 100644 --- a/apps/marketing-astro/package.json +++ b/apps/marketing-astro/package.json @@ -31,6 +31,7 @@ "astro": "^4.9.2", "class-variance-authority": "^0.7.0", "framer-motion": "^11.2.6", + "js-yaml": "^4.1.0", "motion": "^10.18.0", "posthog-js": "^1.133.0", "react": "^18.3.1", diff --git a/apps/marketing-astro/src/pages/docs/[...path].astro b/apps/marketing-astro/src/pages/docs/[...path].astro index 13073d46..462a81f2 100644 --- a/apps/marketing-astro/src/pages/docs/[...path].astro +++ b/apps/marketing-astro/src/pages/docs/[...path].astro @@ -25,6 +25,7 @@ import Heading from "../../components/schema/heading.astro"; import Tabs from "../../components/schema/tabs.astro"; import Tab from "../../components/schema/tab.astro"; import Fence from "../../components/schema/fence.astro"; +import yaml from "js-yaml"; export const prerender = true; @@ -59,7 +60,7 @@ const components = { h6: Heading, tabs: Tabs, tab: Tab, - fence: Fence + fence: Fence, } as Record<string, any>; const { path } = Astro.params; @@ -78,10 +79,18 @@ function isActive(section: any) { return false; } +const frontmatter = ast.attributes.frontmatter + ? (yaml.load(ast.attributes.frontmatter) as Record<string, string>) + : {}; + const sections = await getFiles(); --- -<Root title="" description="" viewTransitions> +<Root + title={frontmatter["title"] + " | Pixeleye"} + description={frontmatter["description"]} + viewTransitions +> <div class="mx-auto px-4"> <div class="relative mx-auto flex w-full flex-auto justify-center sm:px-2 md:px-8" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 34297695..9b3db0b9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -280,6 +280,9 @@ importers: framer-motion: specifier: ^11.2.6 version: 11.2.6(react-dom@18.3.1)(react@18.3.1) + js-yaml: + specifier: ^4.1.0 + version: 4.1.0 motion: specifier: ^10.18.0 version: 10.18.0