From 6e949539ab769299c9cb1b0634431c19858355e7 Mon Sep 17 00:00:00 2001 From: Rainnny7 Date: Wed, 9 Oct 2024 17:17:21 -0400 Subject: [PATCH] add metadata & viewport to the config Took 11 minutes --- config.json.example | 23 +++++++++++++++++++++++ src/app/config.ts | 1 + src/app/layout.tsx | 26 +++----------------------- src/app/types/config.ts | 19 ++++++++++++++++++- src/components/footer.tsx | 8 ++++---- src/components/navbar/navbar.tsx | 2 +- 6 files changed, 50 insertions(+), 29 deletions(-) diff --git a/config.json.example b/config.json.example index e8c0841..20a992c 100644 --- a/config.json.example +++ b/config.json.example @@ -1,4 +1,27 @@ { + "siteName": "Pulse App", + "metadata": { + "title": { + "default": "Pulse Docs", + "template": "Pulse Docs" + }, + "description": "A lightweight service monitoring solution for tracking the availability of whatever service your heart desires!", + "openGraph": { + "images": [ + { + "url": "https://pulseapp.cc/media/logo.png", + "width": 128, + "height": 128 + } + ] + }, + "twitter": { + "card": "summary" + } + }, + "viewport": { + "themeColor": "#A855F7" + }, "contentSource": "{process}/docs", "socialLinks": [ { diff --git a/src/app/config.ts b/src/app/config.ts index fe648c1..604d470 100644 --- a/src/app/config.ts +++ b/src/app/config.ts @@ -2,5 +2,6 @@ * The configuration for this app. */ import config from "@/configJson"; +import { Config } from "@/types/config"; export default config as Config; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index d9b91cd..488831e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -7,33 +7,13 @@ import Sidebar from "@/components/sidebar/sidebar"; import Footer from "@/components/footer"; import { TooltipProvider } from "@/components/ui/tooltip"; import { getDocsContent } from "@/lib/mdx"; +import config from "@/config"; /** * The metadata for this app. */ -export const metadata: Metadata = { - title: { - default: "Pulse Docs", - template: "%s • Pulse Docs", - }, - description: - "A lightweight service monitoring solution for tracking the availability of whatever service your heart desires!", - openGraph: { - images: [ - { - url: "https://pulseapp.cc/media/logo.png", - width: 128, - height: 128, - }, - ], - }, - twitter: { - card: "summary", - }, -}; -export const viewport: Viewport = { - themeColor: "#A855F7", -}; +export const metadata: Metadata = config.metadata; +export const viewport: Viewport = config.viewport; /** * The primary layout for this app. diff --git a/src/app/types/config.ts b/src/app/types/config.ts index 1e7644e..37e6481 100644 --- a/src/app/types/config.ts +++ b/src/app/types/config.ts @@ -1,4 +1,21 @@ -type Config = { +import type { Metadata, Viewport } from "next"; + +export type Config = { + /** + * The name of this app. + */ + siteName: string; + + /** + * The metadata for this app. + */ + metadata: Metadata; + + /** + * The viewport for this app. + */ + viewport: Viewport; + /** * The source to get the content from. * This can either be a local source, or diff --git a/src/components/footer.tsx b/src/components/footer.tsx index 6b3a487..9574586 100644 --- a/src/components/footer.tsx +++ b/src/components/footer.tsx @@ -80,8 +80,8 @@ const Footer = (): ReactElement => ( {/* Copyright */}

- Copyright © {new Date().getFullYear()} Pulse App. All - rights reserved. + Copyright © {new Date().getFullYear()} {config.siteName}. + All rights reserved.

@@ -104,12 +104,12 @@ const Branding = () => ( > Pulse App Logo -

Pulse App

+

{config.siteName}

); diff --git a/src/components/navbar/navbar.tsx b/src/components/navbar/navbar.tsx index aae7069..792ec0b 100644 --- a/src/components/navbar/navbar.tsx +++ b/src/components/navbar/navbar.tsx @@ -20,7 +20,7 @@ const Navbar = ({ pages }: { pages: DocsContentMetadata[] }): ReactElement => (

docs.