Compare commits

..

No commits in common. "main" and "@matthiesenxyz/astro-ghostcms-theme-default@0.1.15" have entirely different histories.

72 changed files with 1451 additions and 1869 deletions

View File

@ -26,13 +26,13 @@ jobs:
- name: Setup npmrc
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
- name: install dependencies
run: pnpm install --no-frozen-lockfile
run: pnpm install
- name: create and publish versions
uses: matthiesenxyz/changeset@v1
with:
version: pnpm ci:version
commit: "chore: update versions"
title: "👷 [ci]: Ready for Release"
title: "Chore: Ready for Release"
publish: pnpm ci:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -14,4 +14,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: kevinzunigacuellar/coauthor-action@v0.1.2
- uses: kevinzunigacuellar/coauthor-action@v0.1.1

View File

@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: MatthiesenXYZ/git-sync-action@v1.1
- uses: jauderho/git-repo-sync@63782025e80e84c48b25a1ee6bb9a22a3bd570d3
with:
# Such as https://github.com/wangchucheng/git-repo-sync.git
target-url: ${{ secrets.GITLAB_URL }}

View File

@ -36,6 +36,7 @@ In this Repo you will find the Following:
- `packages/`:
- [`create-astro-ghostcms`](./packages/create-astro-ghostcms/): CLI Utility to quickly deploy new Astro-GhostCMS projects.
- [`astro-ghostcms`](./packages/astro-ghostcms/): The main Integration!
- [`astro-ghostcms-rendercontent`](./packages/astro-ghostcms-rendercontent/): Allows rendering of remote GhostCMS HTML with Custom Astro Components
- [`astro-ghostcms-theme-default`](./packages/astro-ghostcms-theme-default/): The Default theme in integration mode.
- [`astro-ghostcms-catppuccin`](./packages/astro-ghostcms-catppuccin/): A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS Integration Mode.
- [`astro-ghostcms-brutalbyelian`](./packages/astro-ghostcms-brutalbyelian/): [ElianCodes](https://www.elian.codes/) Brutal theme modified to work with Astro-GhostCMS

View File

@ -22,10 +22,10 @@
"test:starlight:coverage": "pnpm --filter starlight-ghostcms test:coverage"
},
"devDependencies": {
"@biomejs/biome": "1.6.1",
"@biomejs/biome": "1.5.3",
"@changesets/cli": "^2.27.1",
"@vitest/ui": "^1.4.0",
"vitest": "^1.4.0",
"@vitest/ui": "^1.3.1",
"vitest": "^1.3.1",
"vitest-fetch-mock": "^0.2.2"
}
}

View File

@ -1,55 +1,5 @@
# @matthiesenxyz/astro-ghostcms-brutalbyelian
## 0.0.18
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms@3.3.5
## 0.0.17
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.0.16
### Patch Changes
- b0218e1: fix:
- Removed CodeSlot Component that sometimes would break with some <pre> components
- Will be adding at a latter time a custom component to replace this, but at this time this is now fixed.
## 0.0.15
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.0.14
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.0.13
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-brutalbyelian",
"description": "ElianCodes Brutal theme modified to work with Astro-GhostCMS",
"version": "0.0.18",
"version": "0.0.13",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -42,11 +42,11 @@
},
"scripts": {},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"astro": ">=4.4.1"
},
"devDependencies": {
"@typescript-eslint/parser": "^7.2.0",
"@typescript-eslint/parser": "^7.1.1",
"eslint": "^8.57.0",
"eslint-plugin-astro": "^0.31.4",
"eslint-plugin-jsx-a11y": "^6.8.0",
@ -57,12 +57,12 @@
"@eliancodes/brutal-ui": "^0.2.6",
"@iconify-json/logos": "^1.1.41",
"@iconify-json/uil": "^1.1.8",
"@unocss/astro": "^0.58.6",
"@unocss/reset": "^0.58.6",
"astro-font": "^0.0.78",
"@unocss/astro": "^0.58.5",
"@unocss/reset": "^0.58.5",
"astro-font": "^0.0.77",
"astro-remote": "0.3.2",
"typescript": "^5.4.2",
"ultrahtml": "^1.5.3",
"unocss": "^0.58.6"
"unocss": "^0.58.5"
}
}

View File

@ -2,10 +2,6 @@
import { getGhostImgPath } from "../../utils";
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export type Props = {
image: string;
alt?: string;
@ -27,8 +23,5 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
alt={alt}
transition:name={transitionName}
/>
{caption && (
<figcaption class="text-ctp-overlay2">
{useRemote ? <Markup content={caption} /> : <Fragment set:html={caption} />}
</figcaption>)}
{caption && <figcaption class="text-ctp-overlay2"><Markup content={caption} /></figcaption>}
</figure>

View File

@ -0,0 +1,17 @@
---
import { Code } from "astro/components"
import { parse } from "ultrahtml"
import { querySelector } from "ultrahtml/selector"
const html = await Astro.slots.render("default")
const ast = await parse(html)
const codetag = querySelector(ast,'code')
const { children, attributes } = codetag
const code = children[0].value
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
const lang = checkLang ? checkLang : 'plaintxt'
---
<Code code={code} lang={lang}/>

View File

@ -4,5 +4,6 @@ export { default as H3 } from "./H3.astro";
export { default as H4 } from "./H4.astro";
export { default as H5 } from "./H5.astro";
export { default as H6 } from "./H6.astro";
export { default as CodeSlot } from "./CodeSlot.astro";
export { default as Paragraph } from "./Paragraph.astro";
export { default as astrocard } from "./astrocard.astro";

View File

@ -7,9 +7,6 @@ import BlogPostHeader from "../components/blog/BlogPostHeader.astro";
import { Markup } from 'astro-remote';
import * as C from "../components/ghostrender";
import { Card } from "@eliancodes/brutal-ui";
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
export async function getStaticPaths() {
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
@ -33,7 +30,7 @@ invariant(settings, "Settings are required");
<div class="my-5"/>
<div id="ghost">
{useRemote ? <Markup
<Markup
content={post.html}
sanitize={{
allowComponents: true,
@ -46,10 +43,11 @@ invariant(settings, "Settings are required");
h4: C.H4,
h5: C.H5,
h6: C.H6,
pre: C.CodeSlot,
p: C.Paragraph,
astrocard: C.astrocard,
}}
/> : <Fragment set:html={post.html} />}
/>
</div>
</article>

View File

@ -8,7 +8,7 @@ import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/
export async function getStaticPaths() {
const posts = await getAllPosts();
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -2,7 +2,7 @@
import Layout from '../layouts/Default.astro';
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagSummaryCard from '../components/generic/TagSummaryCard.astro';
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
invariant(settings, 'Settings not found');
const title = settings.title;

View File

@ -1,36 +1,5 @@
# @matthiesenxyz/astro-ghostcms-catppuccin
## 0.0.14
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.0.13
### Patch Changes
- b0218e1: fix:
- Removed CodeSlot Component that sometimes would break with some <pre> components
- Will be adding at a latter time a custom component to replace this, but at this time this is now fixed.
## 0.0.12
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.0.11
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.0.10
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-catppuccin",
"description": "A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS",
"version": "0.0.14",
"version": "0.0.10",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -50,7 +50,7 @@
},
"scripts": {},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"astro": ">=4.4.0"
},
"devDependencies": {
@ -60,7 +60,7 @@
"@astrojs/tailwind": "^5.1.0",
"@catppuccin/tailwindcss": "0.1.6",
"@fontsource-variable/inter": "^5.0.17",
"@matthiesenxyz/astro-ghostcms": "^3.3.5",
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
"@tailwindcss/typography": "^0.5.10",
"astro-navbar": "^2.3.1",
"astro-remote": "^0.3.2",

View File

@ -4,9 +4,7 @@ import FeatureImage from "./FeatureImage.astro";
import AuthorList from "./AuthorList.astro";
import { formatDate } from "../utils";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
import * as render from '../components/astro-remote';
export type Props = {
posts: Post[];
@ -64,15 +62,16 @@ const latestFeatured = posts[0]
</div>
<div class="divider my-4"/>
<section id="ghostimport" class="text-ctp-subtext1">
{useRemote ? (latestFeatured && <Markup
{latestFeatured && <Markup
content={latestFeatured.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'astrocard'],
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
}}
/>) : (latestFeatured && <Fragment set:html={latestFeatured.html} />) }
components={{
pre: render.CodeSlot
}}
/> }
</section>
</div>
</main>

View File

@ -3,9 +3,7 @@ import PostHero from "../components/PostHero.astro";
import PostFooter from "../components/PostFooter.astro";
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
import * as render from '../components/astro-remote';
export type Props = {
post: Post;
@ -19,10 +17,10 @@ async function getPostsSet(){
const featuredPosts = await getFeaturedPosts();
const fposts = posts;
if(featuredPosts.posts.length === 0){ return fposts }
else {
const featured = featuredPosts.posts[0]
return fposts.filter((p: Post)=>p.id !== featured.id)
}
}
const mPosts = await getPostsSet()
@ -32,15 +30,16 @@ invariant(settings, "Settings not found");
<PostHero post={post} settings={settings} />
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
{useRemote ? (
<Markup
content={post.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'astrocard'],
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
}}
components={{
pre: render.CodeSlot
}}
/>
) : <Fragment set:html={post.html} /> }
</div>
<PostFooter post={post} settings={settings} posts={mPosts} />

View File

@ -0,0 +1,17 @@
---
import { Code } from "astro/components"
import { parse } from "ultrahtml"
import { querySelector } from "ultrahtml/selector"
const html = await Astro.slots.render("default")
const ast = await parse(html)
const codetag = querySelector(ast,'code')
const { children, attributes } = codetag
const code = children[0].value
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
const lang = checkLang ? checkLang : 'plaintxt'
---
<Code code={code} lang={lang}/>

View File

@ -0,0 +1 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -7,7 +7,7 @@ import PostPreview from '../../components/PostPreview.astro';
export async function getStaticPaths() {
const posts = await getAllPosts();
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -6,7 +6,7 @@ import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcm
let title = "All Tags";
let description = "All the tags used so far...";
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
invariant(settings, 'Settings not found');

View File

@ -0,0 +1,60 @@
# @matthiesenxyz/astro-ghostcms-rendercontent
## 0.0.9
### Patch Changes
- 2724119: Prep to deprecate this package. Moving to `astro-remote`
## 0.0.8
### Patch Changes
- f921005: Bump dependencies:
- vite from to
- @eliancodes/brutal-ui from to
- typescript from to
- ultrahtml from to
- @fontsource-variable/inter from to
- astro-seo from to
- astro from to
- sass from to
- @astrojs/starlight from to
- sharp from to
## 0.0.7
### Patch Changes
- 1f850db: Bump dependencies:
- astro from to
- vite from to
- astro-seo from to
- sass from to
## 0.0.6
### Patch Changes
- 3a5aea9: Updated Tests and Linted packages
## 0.0.5
### Patch Changes
- 455ad3f: Bump astro from 4.0.0 to 4.3.7
- 12be739: Depencency updates
## 0.0.4
### Patch Changes
- Fix License File
## 0.0.3
### Patch Changes
- Initialization of changeset cli

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 MatthiesenXYZ - Astro-GhostCMS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,35 @@
# Astro GhostCMS Content API HTML Processor
## NOTE: This package is no longer in use - Please switch to [`astro-remote`](https://github.com/natemoo-re/astro-remote)
Render remote GhostCMS HTML in Astro with full control over the output.
Powered by [`ultrahtml`](https://github.com/natemoo-re/ultrahtml).
## Rendering Remote Content
The most basic function of `astro-ghostcms-rendercontent` is to convert a string of HTML to Astro friendly HTML. Use the `GhostRender` component.
```astro
---
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
---
<GhostRender content={post.html} />
```
### Customization
`GhostRender` allows full control over the rendering of output. The `components` option allows you to replace a standard HTML element with a custom component.
```astro
---
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
import Title from '../components/Title.astro';
---
<!-- Render <h1> as custom <Title> component -->
<GhostRender content={post.html} components={{ h1: Title }} />
```
For examples on how to setup custom components check [examples](./examples/)

View File

@ -0,0 +1,12 @@
---
import { Code } from "astro/components"
import { parse } from "ultrahtml"
import { querySelector } from "ultrahtml/selector"
const html = await Astro.slots.render("default")
const ast = await parse(html)
const codetag = querySelector(ast,'code')
const { children } = codetag
const code = children[0].value
---
<Code code={code} lang={"sh"} theme={"monokai"}/>

View File

@ -0,0 +1,5 @@
---
---
<h1 class="righteous">
<slot />
</h1>

View File

@ -0,0 +1,5 @@
---
---
<h2 class="righteous">
<slot />
</h2>

View File

@ -0,0 +1,5 @@
---
---
<h3 class="righteous">
<slot />
</h3>

View File

@ -0,0 +1,5 @@
---
---
<h4 class="righteous">
<slot />
</h4>

View File

@ -0,0 +1,5 @@
---
---
<h5 class="righteous">
<slot />
</h5>

View File

@ -0,0 +1,5 @@
---
---
<h6 class="righteous">
<slot />
</h6>

View File

@ -0,0 +1,21 @@
---
---
<p class="my-5"><slot /></p>
<style is:inline>
#ghost p a {
color: rgb(0, 123, 247);
}
#ghost ul li a {
color: rgb(0, 123, 247);
}
#ghost ul li {
padding-top: 0.5rem;
margin-left: 2rem;
list-style: circle;
}
#ghost ul {
margin-top: 1rem;
margin-bottom: 1rem;
}
</style>

View File

@ -0,0 +1,8 @@
export { default as H1 } from "./H1.astro";
export { default as H2 } from "./H2.astro";
export { default as H3 } from "./H3.astro";
export { default as H4 } from "./H4.astro";
export { default as H5 } from "./H5.astro";
export { default as H6 } from "./H6.astro";
export { default as CodeSlot } from "./CodeSlot.astro";
export { default as Paragraph } from "./Paragraph.astro";

View File

@ -0,0 +1 @@
export { default as GhostRender } from "./lib/GhostRender.astro";

View File

@ -0,0 +1,18 @@
---
import { createComponentProxy, html } from './utils';
export interface Props {
content?: string;
components?: Record<string, any>;
}
const input = Astro.props.content ?? await Astro.slots.render('default');
if (!input) {
throw new Error('Unable to render <GhostRender> without a content prop or children')
}
// @ts-ignore
const components = createComponentProxy($$result, Astro.props.components);
const content = await html(input, { components });
---
<Fragment set:html={content} />

View File

@ -0,0 +1 @@
/// <reference types="astro/client" />

View File

@ -0,0 +1,59 @@
import { jsx as h } from "astro/jsx-runtime";
import { renderJSX } from "astro/runtime/server/jsx";
import * as entities from "entities";
import { transform } from "ultrahtml";
import { __unsafeHTML } from "ultrahtml";
import swap from "ultrahtml/transformers/swap";
export function createComponentProxy(
result,
_components: Record<string, any> = {},
) {
const components = {};
for (const [key, value] of Object.entries(_components)) {
if (typeof value === "string") {
components[key] = value;
} else {
components[key] = async (props, children) => {
if (key === "CodeBlock" || key === "CodeSpan") {
props.code = entities.decode(JSON.parse(`"${props.code}"`));
}
const output = await renderJSX(
result,
h(value, { ...props, "set:html": children.value }),
);
return __unsafeHTML(output);
};
}
}
return components;
}
function getIndent(ln: string): string {
if (ln.trim() === ln) return "";
return ln.slice(0, ln.length - ln.trim().length);
}
export function dedent(str: string): string {
const lns = str.replace(/^[\r\n]+/, "").split("\n");
let indent = getIndent(lns[0]);
if (indent.length === 0 && lns.length > 1) {
indent = getIndent(lns[1]);
}
return lns
.map((ln) => (ln.startsWith(indent) ? ln.slice(indent.length) : ln))
.map((ln, i, { length }) => (i === length - 1 ? ln.trim() : ln))
.join("\n");
}
export interface HTMLOptions {
// biome-ignore lint/complexity/noBannedTypes: <explanation>
components?: {};
}
export async function html(
input: string,
opts: HTMLOptions = {},
): Promise<string> {
return transform(dedent(input), [swap(opts.components)]);
}

View File

@ -0,0 +1,47 @@
{
"name": "@matthiesenxyz/astro-ghostcms-rendercontent",
"type": "module",
"version": "0.0.9",
"repository": {
"type": "git",
"url": "git+https://github.com/MatthiesenXYZ/astro-ghostcms.git"
},
"bugs": {
"url": "https://github.com/MatthiesenXYZ/astro-ghostcms/issues",
"email": "issues@astro-ghostcms.xyz"
},
"publishConfig": {
"access": "public"
},
"sideEffects": false,
"homepage": "https://astro-ghostcms.xyz",
"files": [
"examples",
"lib",
"index.ts",
"CHANGELOG.md"
],
"types": "./index.ts",
"exports": {
".": "./index.ts",
"./lib/*": "./lib/*",
"./examples/*": "./examples/*",
"./package.json": "./package.json"
},
"keywords": [
"astro-ghostcms"
],
"author": {
"email": "adam@matthiesen.xyz",
"name": "Adam Matthiesen - MatthiesenXYZ",
"url": "https://matthiesen.xyz"
},
"license": "MIT",
"dependencies": {
"entities": "^4.5.0",
"ultrahtml": "^1.5.3"
},
"devDependencies": {
"astro": "4.4.13"
}
}

View File

@ -1,55 +1,5 @@
# @matthiesenxyz/astro-ghostcms-theme-default
## 0.1.20
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms@3.3.5
## 0.1.19
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms@3.3.4
## 0.1.18
### Patch Changes
- b0218e1: fix:
- Removed CodeSlot Component that sometimes would break with some <pre> components
- Will be adding at a latter time a custom component to replace this, but at this time this is now fixed.
## 0.1.17
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms@3.3.2
## 0.1.16
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.1.15
### Patch Changes

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
"description": "Default Theme for astro-ghostcms",
"version": "0.1.20",
"version": "0.1.15",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -43,17 +43,17 @@
"scripts": {},
"devDependencies": {
"@matthiesenxyz/astro-ghostcms": "*",
"@astrojs/check": "^0.5.9",
"@astrojs/check": "^0.5.6",
"typescript": "^5.4.2"
},
"peerDependencies": {
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
"astro": ">=4.4.0"
},
"dependencies": {
"astro-font": "^0.0.78",
"astro-font": "^0.0.77",
"astro-remote": "^0.3.2",
"sass": "^1.72.0",
"sass": "^1.71.1",
"ultrahtml": "^1.5.3"
}
}

View File

@ -2,10 +2,7 @@
import FeatureImage from "../components/FeatureImage.astro";
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
import * as render from '../components/astro-remote';
export type Props = {
page: Page;
settings: Settings;
@ -29,15 +26,15 @@ const { page, settings, pageClass } = Astro.props as Props;
<section class="gh-content gh-canvas">
<h1 class="article-title">{page.title}</h1>
{useRemote ? (
<Markup
content={page.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'astrocard'],
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
}}
/>
) : <Fragment set:html={page.html} /> }
components={{
pre: render.CodeSlot
}} />
</section>
</article>
</main>

View File

@ -3,10 +3,7 @@ import PostHero from "../components/PostHero.astro";
import PostFooter from "../components/PostFooter.astro";
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
import { Markup } from 'astro-remote';
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
const useRemote = config.ThemeProvider.astroRemote.enable;
import * as render from '../components/astro-remote';
export type Props = {
post: Post;
settings: Settings;
@ -21,15 +18,15 @@ invariant(settings, "Settings not found");
<article class={`article post ${postClass}`}>
<PostHero post={post} settings={settings} />
<section class="gh-content gh-canvas">
{useRemote ? (
<Markup
content={post.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'astrocard'],
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
}}
/>
) : <Fragment set:html={post.html} /> }
components={{
pre: render.CodeSlot
}} />
</section>
</article>
<PostFooter post={post} settings={settings} posts={posts} />

View File

@ -0,0 +1,17 @@
---
import { Code } from "astro/components"
import { parse } from "ultrahtml"
import { querySelector } from "ultrahtml/selector"
const html = await Astro.slots.render("default")
const ast = await parse(html)
const codetag = querySelector(ast,'code')
const { children, attributes } = codetag
const code = children[0].value
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
const lang = checkLang ? checkLang : 'plaintext'
---
<Code code={code} lang={lang}/>

View File

@ -0,0 +1 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -1,13 +1,13 @@
---
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import PostPreview from "../../components/PostPreview.astro";
import DefaultPageLayout from "../../layouts/default.astro";
import PostPreview from "../../components/PostPreview.astro";
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import { getGhostImgPath } from "../../utils";
export async function getStaticPaths() {
const posts = await getAllPosts();
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -1,13 +1,13 @@
---
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagCard from "../components/TagCard.astro";
import DefaultPageLayout from "../layouts/default.astro";
import TagCard from "../components/TagCard.astro";
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
let title = "All Tags";
let description = "All the tags used so far...";
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings not found");
---

View File

@ -1,46 +1,5 @@
# @matthiesenxyz/astro-ghostcms
## 3.3.5
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
- Updated dependencies [f82035b]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.20
## 3.3.4
### Patch Changes
- f097c6a: Adds a toggleswitch to allow users to disable astro-remote usage for rendering ghost-content
- Updated dependencies [f097c6a]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.19
## 3.3.3
### Patch Changes
- b685e66: Update Deps
## 3.3.2
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
- Updated dependencies [4c1002a]
- @matthiesenxyz/astro-ghostcms-theme-default@0.1.17
## 3.3.1
### Patch Changes

View File

@ -66,9 +66,6 @@ export default defineConfig({
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
disableThemeProvider: false, // OPTIONAL - Default False
theme: "@matthiesenxyz/astro-ghostcms-theme-default", // OPTIONAL - Default Theme shown.
astroRemote: {
enable: true // OPTIONAL - Default True, Allows the user to switch to standard <Fragment> html rendering if they are having issues with Astro-remote
}
};
disableDefault404: false, // Allows the user to disable the default `/404 page, to be able to create their own under `/src/pages/404.astro`.
enableRSSFeed: true, // Allows the user to Enable or disable RSS Feed Generation. Default: true

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/astro-ghostcms",
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
"version": "3.3.5",
"version": "3.3.1",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -61,24 +61,24 @@
},
"devDependencies": {
"@types/fs-extra": "^11.0.4",
"@types/node": "^20.11.28",
"vitest": "^1.4.0",
"@types/node": "^20.11.25",
"vitest": "^1.3.1",
"vitest-fetch-mock": "^0.2.2"
},
"dependencies": {
"@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.1.1",
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.20",
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.14",
"@resvg/resvg-js": "^2.6.0",
"@ts-ghost/core-api": "^6.0.0",
"@ts-ghost/content-api": "^4.0.12",
"astro-integration-kit": "^0.6.0",
"astro-integration-kit": "^0.5.1",
"astro-robots-txt": "^1.0.0",
"fs-extra": "^11.2.0",
"package-json": "^10.0.0",
"picocolors": "^1.0.0",
"satori": "^0.10.13",
"satori-html": "^0.3.2",
"vite": "^5.1.6"
"vite": "^5.1.5"
}
}

View File

@ -1,5 +1,5 @@
import { TSGhostContentAPI } from "@ts-ghost/content-api";
import type { Page, Post, Tag } from "../schemas/api";
import type { Page, Post } from "../schemas/api";
// LOAD ENVIRONMENT VARIABLES
import { loadEnv } from "vite";
@ -94,20 +94,17 @@ export const getSettings = async () => {
};
export const getAllTags = async () => {
const tags: Tag[] = [];
let cursor = await api.tags
.browse({
limit: 'all'
})
const results = await api.tags
.browse()
.include({ "count.posts": true })
.paginate();
if (cursor.current.success) tags.push(...cursor.current.data);
while (cursor.next) {
cursor = await cursor.next.paginate();
if (cursor.current.success) tags.push(...cursor.current.data);
.fetch();
if (!results.success) {
throw new Error(results.errors.map((e) => e.message).join(", "));
}
return tags;
return {
tags: results.data,
meta: results.meta,
};
};
export const getFeaturedPosts = async () => {

View File

@ -16,7 +16,7 @@ import satoriOG from "../../satori";
export const getStaticPaths: GetStaticPaths = async () => {
const result: GetStaticPathsItem[] = [];
const posts = await getAllPosts();
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings are required");

View File

@ -17,19 +17,22 @@ export const GhostUserConfigSchema = z.object({
/** OPTIONAL - Configure the Theme Provider
* @ This option allows the user to configure the Theme Provider
*/
ThemeProvider: z.object({
ThemeProvider: z
.object({
/** OPTIONAL - Disable the theme provider
* @default false
*/
disableThemeProvider: z.coerce.boolean().default(false),
disableThemeProvider: z.coerce.boolean(),
/** OPTIONAL - Set the theme you want to use
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
*/
theme: z.string().default("@matthiesenxyz/astro-ghostcms-theme-default"),
astroRemote: z.object({
enable: z.boolean().default(true),
}).optional().default({}),
}).optional().default({}),
theme: z.string(),
})
.optional()
.default({
disableThemeProvider: false,
theme: "@matthiesenxyz/astro-ghostcms-theme-default"
}),
/** Allows the user to disable the provided 404 page */
disableDefault404: z.coerce.boolean().optional(),
/** Allows the user to disable the provided RSS Feed */

View File

@ -1,11 +1,5 @@
# @matthiesenxyz/create-astro-ghostcms
## 0.1.2
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
## 0.1.1
### Patch Changes

View File

@ -1,6 +1,6 @@
{
"name": "@matthiesenxyz/create-astro-ghostcms",
"version": "0.1.2",
"version": "0.1.1",
"description": "Utility to quickly get started with our Integration and astro",
"type": "module",
"main": "./create-astro-ghostcms.mjs",
@ -44,7 +44,7 @@
"devDependencies": {
"@types/fs-extra": "^11.0.1",
"@types/gunzip-maybe": "^1.4.0",
"@types/node": "^20.11.28",
"@types/node": "^20.11.25",
"@types/tar-fs": "^2.0.1",
"typescript": "^5.4.2"
},

View File

@ -1,13 +1,13 @@
---
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
import PostPreview from "../../components/PostPreview.astro";
import DefaultPageLayout from "../../layouts/default.astro";
import PostPreview from "../../components/PostPreview.astro";
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import { getGhostImgPath } from "../../utils";
export async function getStaticPaths() {
const posts = await getAllPosts();
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
return tags.map((tag) => {

View File

@ -1,13 +1,13 @@
---
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
import TagCard from "../components/TagCard.astro";
import DefaultPageLayout from "../layouts/default.astro";
import TagCard from "../components/TagCard.astro";
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
let title = "All Tags";
let description = "All the tags used so far...";
const tags = await getAllTags();
const { tags } = await getAllTags();
const settings = await getSettings();
invariant(settings, "Settings not found");
---

View File

@ -1,66 +1,5 @@
# @matthiesenxyz/starlight-ghostcms
## 0.1.9
### Patch Changes
- f82035b: Bump dependencies:
- astro-integration-kit from to
- @unocss/astro from to
- @unocss/reset from to
- astro-font from to
- unocss from to
- sass from to
- @matthiesenxyz/astro-gists from to
- vite-tsconfig-paths from to
- astro from to
## 0.1.8
### Patch Changes
- b0218e1: fix:
- Removed CodeSlot Component that sometimes would break with some <pre> components
- Will be adding at a latter time a custom component to replace this, but at this time this is now fixed.
## 0.1.7
### Patch Changes
- b685e66: Update Deps
## 0.1.6
### Patch Changes
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
## 0.1.5
### Patch Changes
- a02c78b: bump starlight-ghostcms
## 0.1.4
### Patch Changes
- 209e99b: update deps
## 0.1.4
### Patch Changes
- 746fcc5: Fix html rendering to allow custom components
## 0.1.3
### Patch Changes
- 205738c: fix bug, and resolved config issue that was now will allow users to pass the ghostURL within their `astro.config.mjs`
## 0.1.2
### Patch Changes

View File

@ -49,9 +49,7 @@ export default defineConfig({
integrations: [
starlight({
plugins: [
starlightGhostCMS({
ghostURL: "https://ghostdemo.matthiesen.xyz"
})
starlightGhostCMS()
],
title: 'My Docs',
}),
@ -65,7 +63,7 @@ You must also create 2 environment variables in a `.env` file with the following
```env
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz // ghostURL option in `astro.config.mjs` will take priority. (This is fallback option)
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
GITHUB_PERSONAL_TOKEN=ghp_ //OPTIONAL - This is for Astro-Gists if you choose to use it!
```

View File

@ -1,14 +1,18 @@
import type { StarlightPlugin, StarlightUserConfig } from "@astrojs/starlight/types";
import type { AstroIntegrationLogger } from "astro";
import { type StarlightGhostConfig, validateConfig } from "./src/schemas/config";
import { facebook, getSettings, invariant, twitter } from "./src/utils/api";
import starlightGhostcms from "./src/integrations/starlight-ghostcms";
const settings = await getSettings();
export type { StarlightGhostConfig };
export default function starlightGhostCMS(
userConfig?: StarlightGhostConfig,
): StarlightPlugin {
const config: StarlightGhostConfig = validateConfig(userConfig);
invariant(settings, "Settings not available... check your api key/url");
return {
name: "@matthiesenxyz/starlight-ghostcms-plugin",
@ -28,6 +32,8 @@ export default function starlightGhostCMS(
social: {
...starlightConfig.social,
...overrideRSS(starlightConfig.social, astroConfig.site),
...overrideTwitter(starlightConfig.social),
...overrideFacebook(starlightConfig.social),
},
components: {
...starlightConfig.components,
@ -53,7 +59,6 @@ export default function starlightGhostCMS(
};
}
function overrideRSS(
socials: StarlightUserConfig["social"],
url: string | undefined
@ -63,6 +68,26 @@ function overrideRSS(
return { rss: `${url}/rss.xml` };
}
function overrideTwitter(
socials: StarlightUserConfig["social"],
) {
if (socials?.twitter) { return {}; }
if (settings?.twitter) {
return { twitter: twitter(settings.twitter), }
}
return undefined;
}
function overrideFacebook(
socials: StarlightUserConfig["social"],
) {
if (socials?.facebook) { return {}; }
if (settings?.facebook) {
return { facebook: facebook(settings.facebook), }
}
return undefined;
}
function overrideStarlightComponent(
components: StarlightUserConfig["components"],
logger: AstroIntegrationLogger,

View File

@ -1,7 +1,7 @@
{
"name": "@matthiesenxyz/starlight-ghostcms",
"description": "Starlight GhostCMS plugin to allow easier importing of GhostCMS Content into your starlight website",
"version": "0.1.9",
"version": "0.1.2",
"homepage": "https://astro-ghostcms.xyz/",
"type": "module",
"license": "MIT",
@ -54,19 +54,20 @@
},
"devDependencies": {
"@astrojs/starlight": "^0.21.1",
"vitest": "^1.4.0",
"astro": "^4.4.13",
"vitest": "^1.3.1",
"vitest-fetch-mock": "^0.2.2"
},
"dependencies": {
"@astrojs/rss": "^4.0.5",
"@matthiesenxyz/astro-gists": "^0.2.11",
"@matthiesenxyz/astro-gists": "^0.2.1",
"@ts-ghost/core-api": "^6.0.0",
"@ts-ghost/content-api": "^4.0.12",
"astro-integration-kit": "^0.6.0",
"astro-integration-kit": "^0.5.1",
"astro-remote": "^0.3.2",
"ultrahtml": "^1.5.3",
"vite": "^5.1.6",
"vite-tsconfig-paths": "^4.3.2"
"vite": "^5.1.5",
"vite-tsconfig-paths": "^4.3.1"
},
"peerDependencies": {
"@astrojs/starlight": ">=0.19.0",

View File

@ -0,0 +1,17 @@
---
import { Code } from "@astrojs/starlight/components"
import { parse } from "ultrahtml"
import { querySelector } from "ultrahtml/selector"
const html = await Astro.slots.render("default")
const ast = await parse(html)
const codetag = querySelector(ast,'code')
const { children, attributes } = codetag
const code = children[0].value
const checkLang = attributes.class ? attributes.class.slice(9) : undefined
const lang = checkLang ? checkLang : 'txt'
---
<Code code={code} lang={lang}/>

View File

@ -0,0 +1 @@
export { default as CodeSlot } from "./CodeSlot.astro";

View File

@ -6,17 +6,12 @@ import { corePlugins } from "astro-integration-kit/plugins";
import { z } from "astro/zod";
import { type StarlightGhostConfig } from "../schemas/config";
import astroGists from "@matthiesenxyz/astro-gists";
import { AstroError } from "astro/errors";
import { loadEnv } from "vite";
// Load environment variables
const ENV = loadEnv("all", process.cwd(), "CONTENT_API");
export default defineIntegration({
name: "@matthiesenxyz/starlight-ghostcms",
optionsSchema: z.custom<StarlightGhostConfig>(),
plugins: [...corePlugins],
setup({ options, name }) {
setup({ options }) {
const { resolve } = createResolver(import.meta.url);
return {
@ -29,23 +24,6 @@ export default defineIntegration({
}) => {
watchIntegration(resolve());
// Check for GhostCMS API Key
if (ENV.CONTENT_API_KEY === undefined) {
throw new AstroError(
`${name} CONTENT_API_KEY is not set in environment variables`,
);
}
// Check for GhostCMS URL
if (options.ghostURL === undefined) {
logger.warn("ghostURL is not set in user configuration falling back to environment variable");
if (ENV.CONTENT_API_URL === undefined) {
throw new AstroError(
`${name} CONTENT_API_URL is not set in environment variables`,
);
}
}
// Add the AstroGist integration if enabled
logger.info("Adding @matthiesenxyz/astro-gists integration ...");
addIntegration(astroGists());

View File

@ -6,6 +6,7 @@ import { getPageProps } from '../utils/page';
import { getAllPosts } from '../utils/api';
import Metadata from '../components/Metadata.astro';
import { Markup } from 'astro-remote';
import * as render from '../components/astro-remote';
import * as Gists from '@matthiesenxyz/astro-gists/components';
export async function getStaticPaths() {
@ -48,8 +49,10 @@ const pageProps = getPageProps(post.title)
content={post.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span', 'script', 'getgist', 'getgistgroup', 'astrocard'],
}}
components={{
pre: render.CodeSlot,
getgist: Gists.GetGist,
getgistgroup: Gists.GetGistGroup,
}}

View File

@ -6,27 +6,29 @@ import Page from '../components/Page.astro'
import { getPageProps } from '../utils/page'
import { getSluggedPage } from '../utils/api'
import { Markup } from 'astro-remote'
import * as render from '../components/astro-remote';
const aboutPage = await getSluggedPage("about");
//const { entries, nextLink, prevLink } = Astro.props
const pageProps = getPageProps(aboutPage ? aboutPage.post.title : "")
const pageProps = getPageProps(aboutPage?.post?.title)
---
<Page {...pageProps}>
{config.supportGhost && (
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
)}
{aboutPage &&
<Metadata entry={aboutPage.post} />
<Markup
content={aboutPage.post.html}
sanitize={{
allowComponents: true,
allowElements: ['a', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img', 'figure', 'figcaption', 'ul', 'ol', 'li', 'blockquote', 'pre', 'code', 'em', 'strong', 'del', 'hr', 'br', 'table', 'thead', 'tbody', 'tr', 'th', 'td', 'caption', 'div', 'span'],
}}
/>
}
components={{
pre: render.CodeSlot
}} />
<footer class="not-content">
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
</footer>

View File

@ -3,10 +3,6 @@ import { z } from "astro/zod";
const configSchema = z
.object({
/**
* The URL of the GhostCMS instance.
*/
ghostURL: z.string().url().optional(),
/**
* The number of blog posts to display per page in the blog post list.
*/
@ -35,8 +31,8 @@ const configSchema = z
* Turn on and off "Powered by Ghost"
*/
supportGhost: z.boolean().default(true),
verbose: z.boolean().default(false),
});
})
.default({ postCount: 5, recentPostCount: 10, route: "blog", title: "Blog", rssDescription: "My Awesome Starlight-GhostCMS Blog", supportGhost: true});
export function validateConfig(userConfig: unknown): StarlightGhostConfig {
const config = configSchema.safeParse(userConfig);

View File

@ -3,7 +3,7 @@ import type { Page, Post } from "./schemas";
// LOAD ENVIRONMENT VARIABLES
import { loadEnv } from "vite";
import config from "virtual:starlight-ghostcms/config";
//import StarlightGhostConfig from "virtual:starlight-ghostcms/config";
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
"all",
@ -11,9 +11,12 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
"CONTENT_",
);
//const ConfURL = StarlightGhostConfig.ghostURL || "";
// SETUP GHOST API
const ghostApiKey = CONTENT_API_KEY || "";
const ghostUrl = config.ghostURL || CONTENT_API_URL || "";
const ghostUrl = CONTENT_API_URL || "";
const version = "v5.0";
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
@ -98,15 +101,6 @@ export const getAllPages = async () => {
return pages;
};
export const getSettings = async () => {
const res = await api.settings.fetch();
if (res.success) {
return res.data;
}
return null;
};
export const getSluggedPage = async (slug:string) => {
const results = await api.pages
.read({slug: slug})
@ -116,16 +110,21 @@ export const getSluggedPage = async (slug:string) => {
}).fetch()
if (!results.success) {
if (config.verbose === true){
console.log(`[Starlight-GhostCMS]: ${results.errors.map((e) => e.message).join(", ")}Resource: (${slug})`);
}
return null;
throw new Error(results.errors.map((e) => e.message).join(", "));
}
return {
post: results.data,
};
};
export const getSettings = async () => {
const res = await api.settings.fetch();
if (res.success) {
return res.data;
}
return null;
};
export const getAllTags = async () => {
const results = await api.tags
.browse()

View File

@ -1,21 +1,18 @@
import ghostcms from "@matthiesenxyz/astro-ghostcms";
import { defineConfig } from "astro/config";
// import tailwind from "@astrojs/tailwind";
// import UnoCSS from "unocss/astro";
///import tailwind from "@astrojs/tailwind";
//import UnoCSS from "unocss/astro";
// https://astro.build/config
export default defineConfig({
site: "https://demo.astro-ghostcms.xyz/",
integrations: [
//tailwind(),
// UnoCSS({ injectReset: true }),
//UnoCSS({ injectReset: true }),
ghostcms({
ghostURL: 'https://ghostdemo.matthiesen.xyz',
ThemeProvider: {
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
astroRemote: {
enable: true,
},
},
verbose: true,
}),

View File

@ -11,18 +11,18 @@
"astro": "astro"
},
"dependencies": {
"astro": "^4.5.6",
"astro": "^4.4.13",
"@matthiesenxyz/astro-ghostcms": "workspace:*",
"@matthiesenxyz/astro-ghostcms-theme-default": "workspace:*",
"@matthiesenxyz/astro-ghostcms-catppuccin": "workspace:*",
"@matthiesenxyz/astro-ghostcms-brutalbyelian": "workspace:*",
"@astrojs/tailwind": "^5.1.0",
"@unocss/astro": "^0.58.6",
"@unocss/astro": "^0.58.5",
"tailwindcss": "^3.3.5"
},
"devDependencies": {
"@unocss/reset": "^0.58.6",
"@unocss/reset": "^0.58.5",
"typescript": "^5.4.2",
"unocss": "^0.58.6"
"unocss": "^0.58.5"
}
}

View File

@ -10,7 +10,6 @@ export default defineConfig({
title: "My Docs",
plugins: [
starlightGhostCMS({
ghostURL: "https://ghostdemo.matthiesen.xyz",
title: "Demo Blog",
rssDescription: "Starlight Playground",
route: "blog",

View File

@ -11,14 +11,11 @@
"preview": "astro preview",
"astro": "astro"
},
"devDependencies": {
"@types/node": "^20.11.28"
},
"devDependencies": {},
"dependencies": {
"@astrojs/starlight": "^0.21.1",
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
"@matthiesenxyz/astro-gists": "^0.2.11",
"astro": "^4.5.6",
"astro": "^4.4.13",
"sharp": "^0.33.2"
}
}

File diff suppressed because it is too large Load Diff