From bf65c12ad5e24171103ab2c318b1367cb4a35e4c Mon Sep 17 00:00:00 2001 From: Daniel Metcalfe Date: Wed, 31 Jan 2024 20:58:09 +0000 Subject: [PATCH 1/2] Add user config type --- .gitignore | 3 ++- config/siteConfig.ts | 30 +++++++++++++++++++++++++++--- content/config.mjs | 4 ++++ pages/_app.tsx | 2 +- 4 files changed, 34 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 67bb0c4f8..52ba516ff 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ node_modules/ .next/ out/ .obsidian/ -.markdowndb/ \ No newline at end of file +.markdowndb/ +tsconfig.tsbuildinfo diff --git a/config/siteConfig.ts b/config/siteConfig.ts index c83ca74f7..00673a4ef 100644 --- a/config/siteConfig.ts +++ b/config/siteConfig.ts @@ -1,8 +1,14 @@ -import { defaultConfig } from "@portaljs/core"; import userConfig from "@/content/config.mjs"; +import { + AnalyticsConfig, + AuthorConfig, + CommentsConfig, + NavConfig, + defaultConfig, +} from "@portaljs/core"; +import { DefaultSeoProps } from "next-seo"; -// TODO types -const siteConfig: any = { +const siteConfig: SiteConfig = { ...defaultConfig, ...userConfig, // prevent theme object overrides for @@ -14,3 +20,21 @@ const siteConfig: any = { }; export default siteConfig; + +export type UserConfig = { + analyticsConfig?: AnalyticsConfig; + comments?: CommentsConfig; + defaultAuthor: string; + editLinkRoot?: string; + logo?: AuthorConfig["logo"]; + navbarTitle?: { + text?: NavConfig["title"]; + logo?: NavConfig["logo"]; + }; + nextSeo?: Partial; + showComments?: boolean; + search?: NavConfig["search"]; + social?: NavConfig["social"]; +} & Partial; + +export type SiteConfig = typeof defaultConfig & typeof userConfig; diff --git a/content/config.mjs b/content/config.mjs index ff8b4c563..d8210b210 100644 --- a/content/config.mjs +++ b/content/config.mjs @@ -1 +1,5 @@ + +/** + * @type {import("../config/siteConfig").UserConfig} + */ export default {}; diff --git a/pages/_app.tsx b/pages/_app.tsx index 93a620f13..0f4996a08 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -54,7 +54,7 @@ const MyApp = ({ Component, pageProps }: AppProps) => { logo: siteConfig.logo, }, theme: { - defaultTheme: siteConfig.theme.default, + defaultTheme: siteConfig.theme.default as "light" | "dark", themeToggleIcon: siteConfig.theme.toggleIcon, }, siteMap, From 7db3e7a98f96daad88140b79967b0a72c73a930e Mon Sep 17 00:00:00 2001 From: Daniel Metcalfe Date: Fri, 16 Feb 2024 17:05:28 +0000 Subject: [PATCH 2/2] Fix TSC error after merge --- config/siteConfig.ts | 1 + public/sitemap.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 public/sitemap.xml diff --git a/config/siteConfig.ts b/config/siteConfig.ts index 00673a4ef..ceb438dd2 100644 --- a/config/siteConfig.ts +++ b/config/siteConfig.ts @@ -32,6 +32,7 @@ export type UserConfig = { logo?: NavConfig["logo"]; }; nextSeo?: Partial; + preProcess: (source: any) => any; showComments?: boolean; search?: NavConfig["search"]; social?: NavConfig["social"]; diff --git a/public/sitemap.xml b/public/sitemap.xml new file mode 100644 index 000000000..ab9117f83 --- /dev/null +++ b/public/sitemap.xml @@ -0,0 +1,48 @@ + + + + https://homostellaris.io/dev/columns-vs-flex-vs-grid + + + + https://homostellaris.io/marketing/seo + + + + https://homostellaris.io/productivity/effective-macos-task-management + + + + https://homostellaris.io/about + + + + https://homostellaris.io/blog/blog-post-fail + + + + https://homostellaris.io/productivity/productivity-system + + + + https://homostellaris.io/tech/roll-your-own-personal-backups + + + + https://homostellaris.io/blog/schedule-your-social-marketing + + + + https://homostellaris.io// + + + + https://homostellaris.io/dev/how-to-test-web-apps + + + + https://homostellaris.io/dev/instance-type + +