From 9dcc5e1932b6c7960fa5daba338f20565810bc23 Mon Sep 17 00:00:00 2001 From: Tanishq Manuja Date: Mon, 9 Oct 2023 08:37:45 +0530 Subject: [PATCH] refactor: update site URL to be single source of truth (#143) * wip: astro config to use .ts instead of .mjs * fix: remove invalid prop in astro config * refactor: single source of truth for site url * refactor: make minor updates due to astro.config.ts --------- Co-authored-by: satnaing --- .prettierignore | 2 +- astro.config.mjs => astro.config.ts | 4 ++-- src/config.ts | 2 +- .../blog/how-to-add-an-estimated-reading-time.md | 2 +- src/content/blog/how-to-configure-astropaper-theme.md | 11 ----------- 5 files changed, 5 insertions(+), 16 deletions(-) rename astro.config.mjs => astro.config.ts (86%) diff --git a/.prettierignore b/.prettierignore index 433ba8e..5d1d4a4 100644 --- a/.prettierignore +++ b/.prettierignore @@ -6,7 +6,7 @@ !/public !/.github !tsconfig.json -!astro.config.mjs +!astro.config.ts !package.json !.prettierrc !.eslintrc.js diff --git a/astro.config.mjs b/astro.config.ts similarity index 86% rename from astro.config.mjs rename to astro.config.ts index 9c2d6b7..dbde794 100644 --- a/astro.config.mjs +++ b/astro.config.ts @@ -4,10 +4,11 @@ import react from "@astrojs/react"; import remarkToc from "remark-toc"; import remarkCollapse from "remark-collapse"; import sitemap from "@astrojs/sitemap"; +import { SITE } from "./src/config"; // https://astro.build/config export default defineConfig({ - site: "https://astro-paper.pages.dev/", // replace this with your deployed domain + site: SITE.website, integrations: [ tailwind({ applyBaseStyles: false, @@ -29,7 +30,6 @@ export default defineConfig({ theme: "one-dark-pro", wrap: true, }, - extendDefaultPlugins: true, }, vite: { optimizeDeps: { diff --git a/src/config.ts b/src/config.ts index b7933f6..b4909b1 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,7 +1,7 @@ import type { Site, SocialObjects } from "./types"; export const SITE: Site = { - website: "https://astro-paper.pages.dev/", + website: "https://astro-paper.pages.dev/", // replace this with your deployed domain author: "Sat Naing", desc: "A minimal, responsive and SEO-friendly Astro blog theme.", title: "AstroPaper", diff --git a/src/content/blog/how-to-add-an-estimated-reading-time.md b/src/content/blog/how-to-add-an-estimated-reading-time.md index bc9a01c..2cff19a 100644 --- a/src/content/blog/how-to-add-an-estimated-reading-time.md +++ b/src/content/blog/how-to-add-an-estimated-reading-time.md @@ -37,7 +37,7 @@ export function remarkReadingTime() { } ``` -Step (3) Add the plugin to `astro.config.mjs` +Step (3) Add the plugin to `astro.config.ts` ```js import { remarkReadingTime } from "./src/utils/remark-reading-time.mjs"; // make sure your relative path is correct diff --git a/src/content/blog/how-to-configure-astropaper-theme.md b/src/content/blog/how-to-configure-astropaper-theme.md index b9e4458..79ce4cb 100644 --- a/src/content/blog/how-to-configure-astropaper-theme.md +++ b/src/content/blog/how-to-configure-astropaper-theme.md @@ -34,17 +34,6 @@ export const SITE = { }; ``` -Then, replace site property of `astro.config.mjs` file with your own deployed domain. _(You can also omit this step if you don't have deployed domain yet or you are still in development mode)_ - -```js -// file: astro.config.mjs -export default defineConfig({ - site: "https://astro-paper.pages.dev/", // replace this with your deployed domain - integrations: [...], - ... -)} -``` - Here are SITE configuration options | Options | Description |