From 7b3b7b386a4fdd3acbc85962dfb48a937d6e8c71 Mon Sep 17 00:00:00 2001 From: Korbs Date: Mon, 23 Dec 2024 16:46:42 -0500 Subject: [PATCH] Add support to add a blog using Ghost, creating a separated blog page --- Dockerfile | 2 +- astro.config.mjs | 4 +-- config.json | 9 ++++++ package.json | 3 +- src/components/Sidebar.astro | 56 ++++++++++++++++++++++------------ src/layouts/Document.astro | 15 ++++++--- src/library/ghost.ts | 8 +++++ src/pages/blog/[...slug].astro | 51 +++++++++++++++++++++++++++++++ src/pages/blog/index.astro | 6 ++++ tsconfig.json | 1 + 10 files changed, 127 insertions(+), 28 deletions(-) create mode 100644 src/library/ghost.ts create mode 100644 src/pages/blog/[...slug].astro create mode 100644 src/pages/blog/index.astro diff --git a/Dockerfile b/Dockerfile index 740d2cb..401b108 100755 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ LABEL org.opencontainers.image.description="Documentations built on Astro" LABEL org.opencontainers.image.licenses="MIT NON-AI License" LABEL org.opencontainers.image.url="https://butterflyvu.docs.sudovanilla.org/" LABEL org.opencontainers.image.source="https://ark.sudovanilla.org/Korbs/ButterflyVu/" -LABEL org.opencontainers.image.version="0.1.8" +LABEL org.opencontainers.image.version="0.1.9" # Copy Files WORKDIR /app diff --git a/astro.config.mjs b/astro.config.mjs index a162e99..bd0d9e6 100755 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -2,14 +2,12 @@ import { defineConfig } from 'astro/config' import vue from "@astrojs/vue" // Settings -import { SiteSettings } from './config.json' +import { SiteSettings, Ghost } from './config.json' // Integrations import mdx from '@astrojs/mdx' import pagefind from "astro-pagefind" - import compressor from 'astro-compressor'; - import pageInsight from 'astro-page-insight'; // Astro Configuration diff --git a/config.json b/config.json index e02b30b..e9d833f 100755 --- a/config.json +++ b/config.json @@ -9,6 +9,11 @@ "WhiteLabel": "true", "FooterVersion": "true" }, + "Ghost": { + "Enabled": true, + "Instance": "https://minpluto.ghost.sudovanilla.org", + "Key": "22f4a31cd6f8cc0b2a2718a0cd" + }, "FeelbackConfig": { "Enabled": false, "ContentSetId": "566e8b96-c65e-4bf7-87df-d22a9f4994a2", @@ -17,6 +22,10 @@ "Answer": "Thank you for your feedback." }, "HeaderItems": [ + { + "text": "Blog", + "link": "/blog/" + }, { "text": "Syntax", "link": "/syntax/" diff --git a/package.json b/package.json index 32aabdc..47afa0a 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "butterflyvu", "type": "module", - "version": "0.1.8", + "version": "0.1.9", "license": "MIT NON-AI License", "author": { "name": "SudoVanilla" @@ -33,6 +33,7 @@ "@astrojs/vue": "^5.0.3", "@iconoir/vue": "^7.10.1", "@minpluto/zorn": "^0.4.83", + "@tryghost/content-api": "^1.11.21", "astro": "5.1.1", "astro-analytics": "^2.7.0", "astro-bun-adapter": "^1.0.2", diff --git a/src/components/Sidebar.astro b/src/components/Sidebar.astro index 186de82..e14fc39 100755 --- a/src/components/Sidebar.astro +++ b/src/components/Sidebar.astro @@ -1,28 +1,46 @@ --- // Settings import { SiteSettings, SidebarItems } from '@config' + +// Properties +const { Blog } = Astro.props + +// Get Posts +import { ghostClient } from "@library/ghost"; +const posts = await ghostClient.posts + .browse({ + limit: "all", + }) + .catch(() => {null}) ---