Compare commits
30 Commits
@matthiese
...
main
Author | SHA1 | Date |
---|---|---|
Adam Matthiesen | ca3e595401 | |
Adam Matthiesen | fa276f9d64 | |
Adam Matthiesen | 5166bdc11f | |
github-actions[bot] | acf9a1def4 | |
dependabot[bot] | f82035b813 | |
dependabot[bot] | a6b2b28843 | |
Adam Matthiesen | c3b8872706 | |
github-actions[bot] | 13d6b551b8 | |
create-issue-branch[bot] | f097c6a18b | |
github-actions[bot] | ec50145786 | |
create-issue-branch[bot] | b0218e182b | |
Adam Matthiesen | 8074b66935 | |
Adam Matthiesen | c57ff7d370 | |
Adam Matthiesen | 2854ad8a33 | |
Adam Matthiesen | cfc6c88a8f | |
github-actions[bot] | e532e1471e | |
create-issue-branch[bot] | b685e6617d | |
dependabot[bot] | 62829e268a | |
Adam Matthiesen | 6f1139f038 | |
github-actions[bot] | f1ee69c8b7 | |
create-issue-branch[bot] | 4c1002a733 | |
github-actions[bot] | 10bcac444b | |
create-issue-branch[bot] | a02c78b323 | |
github-actions[bot] | 6fee8bab1d | |
Adam Matthiesen | 209e99b8c7 | |
github-actions[bot] | b0ebb96783 | |
create-issue-branch[bot] | 746fcc5858 | |
github-actions[bot] | 110c5a973a | |
create-issue-branch[bot] | 205738c288 | |
Adam Matthiesen | fa93f54b68 |
|
@ -26,13 +26,13 @@ jobs:
|
||||||
- name: Setup npmrc
|
- name: Setup npmrc
|
||||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
||||||
- name: install dependencies
|
- name: install dependencies
|
||||||
run: pnpm install
|
run: pnpm install --no-frozen-lockfile
|
||||||
- name: create and publish versions
|
- name: create and publish versions
|
||||||
uses: matthiesenxyz/changeset@v1
|
uses: matthiesenxyz/changeset@v1
|
||||||
with:
|
with:
|
||||||
version: pnpm ci:version
|
version: pnpm ci:version
|
||||||
commit: "chore: update versions"
|
commit: "chore: update versions"
|
||||||
title: "Chore: Ready for Release"
|
title: "👷 [ci]: Ready for Release"
|
||||||
publish: pnpm ci:publish
|
publish: pnpm ci:publish
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
|
@ -14,4 +14,4 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: kevinzunigacuellar/coauthor-action@v0.1.1
|
- uses: kevinzunigacuellar/coauthor-action@v0.1.2
|
||||||
|
|
|
@ -12,7 +12,7 @@ jobs:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- uses: jauderho/git-repo-sync@63782025e80e84c48b25a1ee6bb9a22a3bd570d3
|
- uses: MatthiesenXYZ/git-sync-action@v1.1
|
||||||
with:
|
with:
|
||||||
# Such as https://github.com/wangchucheng/git-repo-sync.git
|
# Such as https://github.com/wangchucheng/git-repo-sync.git
|
||||||
target-url: ${{ secrets.GITLAB_URL }}
|
target-url: ${{ secrets.GITLAB_URL }}
|
||||||
|
|
|
@ -36,7 +36,6 @@ In this Repo you will find the Following:
|
||||||
- `packages/`:
|
- `packages/`:
|
||||||
- [`create-astro-ghostcms`](./packages/create-astro-ghostcms/): CLI Utility to quickly deploy new Astro-GhostCMS projects.
|
- [`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`](./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-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-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
|
- [`astro-ghostcms-brutalbyelian`](./packages/astro-ghostcms-brutalbyelian/): [ElianCodes](https://www.elian.codes/) Brutal theme modified to work with Astro-GhostCMS
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
"test:starlight:coverage": "pnpm --filter starlight-ghostcms test:coverage"
|
"test:starlight:coverage": "pnpm --filter starlight-ghostcms test:coverage"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.5.3",
|
"@biomejs/biome": "1.6.1",
|
||||||
"@changesets/cli": "^2.27.1",
|
"@changesets/cli": "^2.27.1",
|
||||||
"@vitest/ui": "^1.3.1",
|
"@vitest/ui": "^1.4.0",
|
||||||
"vitest": "^1.3.1",
|
"vitest": "^1.4.0",
|
||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,55 @@
|
||||||
# @matthiesenxyz/astro-ghostcms-brutalbyelian
|
# @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
|
## 0.0.13
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms-brutalbyelian",
|
"name": "@matthiesenxyz/astro-ghostcms-brutalbyelian",
|
||||||
"description": "ElianCodes Brutal theme modified to work with Astro-GhostCMS",
|
"description": "ElianCodes Brutal theme modified to work with Astro-GhostCMS",
|
||||||
"version": "0.0.13",
|
"version": "0.0.18",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -42,11 +42,11 @@
|
||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
|
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||||
"astro": ">=4.4.1"
|
"astro": ">=4.4.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/parser": "^7.1.1",
|
"@typescript-eslint/parser": "^7.2.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-plugin-astro": "^0.31.4",
|
"eslint-plugin-astro": "^0.31.4",
|
||||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||||
|
@ -57,12 +57,12 @@
|
||||||
"@eliancodes/brutal-ui": "^0.2.6",
|
"@eliancodes/brutal-ui": "^0.2.6",
|
||||||
"@iconify-json/logos": "^1.1.41",
|
"@iconify-json/logos": "^1.1.41",
|
||||||
"@iconify-json/uil": "^1.1.8",
|
"@iconify-json/uil": "^1.1.8",
|
||||||
"@unocss/astro": "^0.58.5",
|
"@unocss/astro": "^0.58.6",
|
||||||
"@unocss/reset": "^0.58.5",
|
"@unocss/reset": "^0.58.6",
|
||||||
"astro-font": "^0.0.77",
|
"astro-font": "^0.0.78",
|
||||||
"astro-remote": "0.3.2",
|
"astro-remote": "0.3.2",
|
||||||
"typescript": "^5.4.2",
|
"typescript": "^5.4.2",
|
||||||
"ultrahtml": "^1.5.3",
|
"ultrahtml": "^1.5.3",
|
||||||
"unocss": "^0.58.5"
|
"unocss": "^0.58.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@
|
||||||
import { getGhostImgPath } from "../../utils";
|
import { getGhostImgPath } from "../../utils";
|
||||||
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import type { Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
image: string;
|
image: string;
|
||||||
alt?: string;
|
alt?: string;
|
||||||
|
@ -23,5 +27,8 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
|
||||||
alt={alt}
|
alt={alt}
|
||||||
transition:name={transitionName}
|
transition:name={transitionName}
|
||||||
/>
|
/>
|
||||||
{caption && <figcaption class="text-ctp-overlay2"><Markup content={caption} /></figcaption>}
|
{caption && (
|
||||||
|
<figcaption class="text-ctp-overlay2">
|
||||||
|
{useRemote ? <Markup content={caption} /> : <Fragment set:html={caption} />}
|
||||||
|
</figcaption>)}
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
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}/>
|
|
|
@ -4,6 +4,5 @@ export { default as H3 } from "./H3.astro";
|
||||||
export { default as H4 } from "./H4.astro";
|
export { default as H4 } from "./H4.astro";
|
||||||
export { default as H5 } from "./H5.astro";
|
export { default as H5 } from "./H5.astro";
|
||||||
export { default as H6 } from "./H6.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 Paragraph } from "./Paragraph.astro";
|
||||||
export { default as astrocard } from "./astrocard.astro";
|
export { default as astrocard } from "./astrocard.astro";
|
||||||
|
|
|
@ -7,6 +7,9 @@ import BlogPostHeader from "../components/blog/BlogPostHeader.astro";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as C from "../components/ghostrender";
|
import * as C from "../components/ghostrender";
|
||||||
import { Card } from "@eliancodes/brutal-ui";
|
import { Card } from "@eliancodes/brutal-ui";
|
||||||
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
|
const [posts, pages, settings] = await Promise.all([getAllPosts(), await getAllPages(), await getSettings()]);
|
||||||
|
@ -30,10 +33,10 @@ invariant(settings, "Settings are required");
|
||||||
|
|
||||||
<div class="my-5"/>
|
<div class="my-5"/>
|
||||||
<div id="ghost">
|
<div id="ghost">
|
||||||
<Markup
|
{useRemote ? <Markup
|
||||||
content={post.html}
|
content={post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
allowComponents: true,
|
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', 'astrocard'],
|
||||||
}}
|
}}
|
||||||
components={{
|
components={{
|
||||||
|
@ -43,11 +46,10 @@ invariant(settings, "Settings are required");
|
||||||
h4: C.H4,
|
h4: C.H4,
|
||||||
h5: C.H5,
|
h5: C.H5,
|
||||||
h6: C.H6,
|
h6: C.H6,
|
||||||
pre: C.CodeSlot,
|
|
||||||
p: C.Paragraph,
|
p: C.Paragraph,
|
||||||
astrocard: C.astrocard,
|
astrocard: C.astrocard,
|
||||||
}}
|
}}
|
||||||
/>
|
/> : <Fragment set:html={post.html} />}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
|
|
||||||
return tags.map((tag) => {
|
return tags.map((tag) => {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import Layout from '../layouts/Default.astro';
|
import Layout from '../layouts/Default.astro';
|
||||||
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import TagSummaryCard from '../components/generic/TagSummaryCard.astro';
|
import TagSummaryCard from '../components/generic/TagSummaryCard.astro';
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, 'Settings not found');
|
invariant(settings, 'Settings not found');
|
||||||
const title = settings.title;
|
const title = settings.title;
|
||||||
|
@ -16,7 +16,7 @@ const description = settings.description;
|
||||||
description={description}
|
description={description}
|
||||||
>
|
>
|
||||||
<main class='bg-pink p-6'>
|
<main class='bg-pink p-6'>
|
||||||
{
|
{
|
||||||
tags
|
tags
|
||||||
.filter((tag) => tag.slug && !tag.slug.startsWith("hash-"))
|
.filter((tag) => tag.slug && !tag.slug.startsWith("hash-"))
|
||||||
.map((tag) => (
|
.map((tag) => (
|
||||||
|
|
|
@ -1,5 +1,36 @@
|
||||||
# @matthiesenxyz/astro-ghostcms-catppuccin
|
# @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
|
## 0.0.10
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms-catppuccin",
|
"name": "@matthiesenxyz/astro-ghostcms-catppuccin",
|
||||||
"description": "A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS",
|
"description": "A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS",
|
||||||
"version": "0.0.10",
|
"version": "0.0.14",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
},
|
},
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
|
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||||
"astro": ">=4.4.0"
|
"astro": ">=4.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@catppuccin/tailwindcss": "0.1.6",
|
"@catppuccin/tailwindcss": "0.1.6",
|
||||||
"@fontsource-variable/inter": "^5.0.17",
|
"@fontsource-variable/inter": "^5.0.17",
|
||||||
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
|
"@matthiesenxyz/astro-ghostcms": "^3.3.5",
|
||||||
"@tailwindcss/typography": "^0.5.10",
|
"@tailwindcss/typography": "^0.5.10",
|
||||||
"astro-navbar": "^2.3.1",
|
"astro-navbar": "^2.3.1",
|
||||||
"astro-remote": "^0.3.2",
|
"astro-remote": "^0.3.2",
|
||||||
|
|
|
@ -4,7 +4,9 @@ import FeatureImage from "./FeatureImage.astro";
|
||||||
import AuthorList from "./AuthorList.astro";
|
import AuthorList from "./AuthorList.astro";
|
||||||
import { formatDate } from "../utils";
|
import { formatDate } from "../utils";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
posts: Post[];
|
posts: Post[];
|
||||||
|
@ -62,16 +64,15 @@ const latestFeatured = posts[0]
|
||||||
</div>
|
</div>
|
||||||
<div class="divider my-4"/>
|
<div class="divider my-4"/>
|
||||||
<section id="ghostimport" class="text-ctp-subtext1">
|
<section id="ghostimport" class="text-ctp-subtext1">
|
||||||
{latestFeatured && <Markup
|
|
||||||
content={latestFeatured.html}
|
|
||||||
sanitize={{
|
{useRemote ? (latestFeatured && <Markup
|
||||||
allowComponents: true,
|
content={latestFeatured.html}
|
||||||
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'],
|
sanitize={{
|
||||||
}}
|
allowComponents: true,
|
||||||
components={{
|
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'],
|
||||||
pre: render.CodeSlot
|
}}
|
||||||
}}
|
/>) : (latestFeatured && <Fragment set:html={latestFeatured.html} />) }
|
||||||
/> }
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -3,7 +3,9 @@ import PostHero from "../components/PostHero.astro";
|
||||||
import PostFooter from "../components/PostFooter.astro";
|
import PostFooter from "../components/PostFooter.astro";
|
||||||
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import { getFeaturedPosts, invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
|
@ -17,10 +19,10 @@ async function getPostsSet(){
|
||||||
const featuredPosts = await getFeaturedPosts();
|
const featuredPosts = await getFeaturedPosts();
|
||||||
const fposts = posts;
|
const fposts = posts;
|
||||||
if(featuredPosts.posts.length === 0){ return fposts }
|
if(featuredPosts.posts.length === 0){ return fposts }
|
||||||
else {
|
|
||||||
const featured = featuredPosts.posts[0]
|
const featured = featuredPosts.posts[0]
|
||||||
return fposts.filter((p: Post)=>p.id !== featured.id)
|
return fposts.filter((p: Post)=>p.id !== featured.id)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const mPosts = await getPostsSet()
|
const mPosts = await getPostsSet()
|
||||||
|
@ -30,16 +32,15 @@ invariant(settings, "Settings not found");
|
||||||
|
|
||||||
<PostHero post={post} settings={settings} />
|
<PostHero post={post} settings={settings} />
|
||||||
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
||||||
<Markup
|
{useRemote ? (
|
||||||
content={post.html}
|
<Markup
|
||||||
sanitize={{
|
content={post.html}
|
||||||
allowComponents: true,
|
sanitize={{
|
||||||
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'],
|
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'],
|
||||||
components={{
|
}}
|
||||||
pre: render.CodeSlot
|
/>
|
||||||
}}
|
) : <Fragment set:html={post.html} /> }
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<PostFooter post={post} settings={settings} posts={mPosts} />
|
<PostFooter post={post} settings={settings} posts={mPosts} />
|
||||||
|
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
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}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -7,7 +7,7 @@ import PostPreview from '../../components/PostPreview.astro';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
|
|
||||||
return tags.map((tag) => {
|
return tags.map((tag) => {
|
||||||
|
@ -37,7 +37,7 @@ const description = `All of the articles we've posted and linked so far under th
|
||||||
<Layout title={title} description={description} settings={settings}>
|
<Layout title={title} description={description} settings={settings}>
|
||||||
<Container>
|
<Container>
|
||||||
<section class="post-card post-card-large">
|
<section class="post-card post-card-large">
|
||||||
|
|
||||||
<div class="post-card-content">
|
<div class="post-card-content">
|
||||||
<div class="post-card-content-link">
|
<div class="post-card-content-link">
|
||||||
<header class="post-card-header">
|
<header class="post-card-header">
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcm
|
||||||
|
|
||||||
let title = "All Tags";
|
let title = "All Tags";
|
||||||
let description = "All the tags used so far...";
|
let description = "All the tags used so far...";
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, 'Settings not found');
|
invariant(settings, 'Settings not found');
|
||||||
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
# @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
|
|
|
@ -1,21 +0,0 @@
|
||||||
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.
|
|
|
@ -1,35 +0,0 @@
|
||||||
# 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/)
|
|
|
@ -1,12 +0,0 @@
|
||||||
---
|
|
||||||
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"}/>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h1 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h1>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h2 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h2>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h3 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h3>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h4 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h4>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h5 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h5>
|
|
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<h6 class="righteous">
|
|
||||||
<slot />
|
|
||||||
</h6>
|
|
|
@ -1,21 +0,0 @@
|
||||||
---
|
|
||||||
---
|
|
||||||
<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>
|
|
|
@ -1,8 +0,0 @@
|
||||||
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";
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as GhostRender } from "./lib/GhostRender.astro";
|
|
|
@ -1,18 +0,0 @@
|
||||||
---
|
|
||||||
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} />
|
|
|
@ -1 +0,0 @@
|
||||||
/// <reference types="astro/client" />
|
|
|
@ -1,59 +0,0 @@
|
||||||
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)]);
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +1,55 @@
|
||||||
# @matthiesenxyz/astro-ghostcms-theme-default
|
# @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
|
## 0.1.15
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
|
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||||
"description": "Default Theme for astro-ghostcms",
|
"description": "Default Theme for astro-ghostcms",
|
||||||
"version": "0.1.15",
|
"version": "0.1.20",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -43,17 +43,17 @@
|
||||||
"scripts": {},
|
"scripts": {},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms": "*",
|
"@matthiesenxyz/astro-ghostcms": "*",
|
||||||
"@astrojs/check": "^0.5.6",
|
"@astrojs/check": "^0.5.9",
|
||||||
"typescript": "^5.4.2"
|
"typescript": "^5.4.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.1",
|
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||||
"astro": ">=4.4.0"
|
"astro": ">=4.4.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro-font": "^0.0.77",
|
"astro-font": "^0.0.78",
|
||||||
"astro-remote": "^0.3.2",
|
"astro-remote": "^0.3.2",
|
||||||
"sass": "^1.71.1",
|
"sass": "^1.72.0",
|
||||||
"ultrahtml": "^1.5.3"
|
"ultrahtml": "^1.5.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
import FeatureImage from "../components/FeatureImage.astro";
|
import FeatureImage from "../components/FeatureImage.astro";
|
||||||
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
|
import type { Settings, Page } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
page: Page;
|
page: Page;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -26,15 +29,15 @@ const { page, settings, pageClass } = Astro.props as Props;
|
||||||
|
|
||||||
<section class="gh-content gh-canvas">
|
<section class="gh-content gh-canvas">
|
||||||
<h1 class="article-title">{page.title}</h1>
|
<h1 class="article-title">{page.title}</h1>
|
||||||
<Markup
|
{useRemote ? (
|
||||||
content={page.html}
|
<Markup
|
||||||
sanitize={{
|
content={page.html}
|
||||||
allowComponents: true,
|
sanitize={{
|
||||||
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'],
|
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'],
|
||||||
components={{
|
}}
|
||||||
pre: render.CodeSlot
|
/>
|
||||||
}} />
|
) : <Fragment set:html={page.html} /> }
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
|
@ -3,7 +3,10 @@ import PostHero from "../components/PostHero.astro";
|
||||||
import PostFooter from "../components/PostFooter.astro";
|
import PostFooter from "../components/PostFooter.astro";
|
||||||
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
import {invariant, type Post, type Settings } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
import config from "virtual:@matthiesenxyz/astro-ghostcms/config";
|
||||||
|
|
||||||
|
const useRemote = config.ThemeProvider.astroRemote.enable;
|
||||||
|
|
||||||
export type Props = {
|
export type Props = {
|
||||||
post: Post;
|
post: Post;
|
||||||
settings: Settings;
|
settings: Settings;
|
||||||
|
@ -18,15 +21,15 @@ invariant(settings, "Settings not found");
|
||||||
<article class={`article post ${postClass}`}>
|
<article class={`article post ${postClass}`}>
|
||||||
<PostHero post={post} settings={settings} />
|
<PostHero post={post} settings={settings} />
|
||||||
<section class="gh-content gh-canvas">
|
<section class="gh-content gh-canvas">
|
||||||
<Markup
|
{useRemote ? (
|
||||||
content={post.html}
|
<Markup
|
||||||
sanitize={{
|
content={post.html}
|
||||||
allowComponents: true,
|
sanitize={{
|
||||||
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'],
|
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'],
|
||||||
components={{
|
}}
|
||||||
pre: render.CodeSlot
|
/>
|
||||||
}} />
|
) : <Fragment set:html={post.html} /> }
|
||||||
</section>
|
</section>
|
||||||
</article>
|
</article>
|
||||||
<PostFooter post={post} settings={settings} posts={posts} />
|
<PostFooter post={post} settings={settings} posts={posts} />
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
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}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
|
||||||
import DefaultPageLayout from "../../layouts/default.astro";
|
|
||||||
import PostPreview from "../../components/PostPreview.astro";
|
|
||||||
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
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 { getGhostImgPath } from "../../utils";
|
import { getGhostImgPath } from "../../utils";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
|
|
||||||
return tags.map((tag) => {
|
return tags.map((tag) => {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import TagCard from "../components/TagCard.astro";
|
import TagCard from "../components/TagCard.astro";
|
||||||
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
|
|
||||||
|
|
||||||
let title = "All Tags";
|
let title = "All Tags";
|
||||||
let description = "All the tags used so far...";
|
let description = "All the tags used so far...";
|
||||||
|
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, "Settings not found");
|
invariant(settings, "Settings not found");
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,5 +1,46 @@
|
||||||
# @matthiesenxyz/astro-ghostcms
|
# @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
|
## 3.3.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -66,6 +66,9 @@ export default defineConfig({
|
||||||
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
|
ThemeProvider: { // Allows you to pass config options to our ThemeProvider if enabled.
|
||||||
disableThemeProvider: false, // OPTIONAL - Default False
|
disableThemeProvider: false, // OPTIONAL - Default False
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default", // OPTIONAL - Default Theme shown.
|
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`.
|
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
|
enableRSSFeed: true, // Allows the user to Enable or disable RSS Feed Generation. Default: true
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/astro-ghostcms",
|
"name": "@matthiesenxyz/astro-ghostcms",
|
||||||
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
||||||
"version": "3.3.1",
|
"version": "3.3.5",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -61,24 +61,24 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^20.11.25",
|
"@types/node": "^20.11.28",
|
||||||
"vitest": "^1.3.1",
|
"vitest": "^1.4.0",
|
||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/rss": "^4.0.5",
|
"@astrojs/rss": "^4.0.5",
|
||||||
"@astrojs/sitemap": "^3.1.1",
|
"@astrojs/sitemap": "^3.1.1",
|
||||||
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.14",
|
"@matthiesenxyz/astro-ghostcms-theme-default": "^0.1.20",
|
||||||
"@resvg/resvg-js": "^2.6.0",
|
"@resvg/resvg-js": "^2.6.0",
|
||||||
"@ts-ghost/core-api": "^6.0.0",
|
"@ts-ghost/core-api": "^6.0.0",
|
||||||
"@ts-ghost/content-api": "^4.0.12",
|
"@ts-ghost/content-api": "^4.0.12",
|
||||||
"astro-integration-kit": "^0.5.1",
|
"astro-integration-kit": "^0.6.0",
|
||||||
"astro-robots-txt": "^1.0.0",
|
"astro-robots-txt": "^1.0.0",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"package-json": "^10.0.0",
|
"package-json": "^10.0.0",
|
||||||
"picocolors": "^1.0.0",
|
"picocolors": "^1.0.0",
|
||||||
"satori": "^0.10.13",
|
"satori": "^0.10.13",
|
||||||
"satori-html": "^0.3.2",
|
"satori-html": "^0.3.2",
|
||||||
"vite": "^5.1.5"
|
"vite": "^5.1.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
import { TSGhostContentAPI } from "@ts-ghost/content-api";
|
import { TSGhostContentAPI } from "@ts-ghost/content-api";
|
||||||
import type { Page, Post } from "../schemas/api";
|
import type { Page, Post, Tag } from "../schemas/api";
|
||||||
|
|
||||||
// LOAD ENVIRONMENT VARIABLES
|
// LOAD ENVIRONMENT VARIABLES
|
||||||
import { loadEnv } from "vite";
|
import { loadEnv } from "vite";
|
||||||
|
@ -94,17 +94,20 @@ export const getSettings = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAllTags = async () => {
|
export const getAllTags = async () => {
|
||||||
const results = await api.tags
|
const tags: Tag[] = [];
|
||||||
.browse()
|
let cursor = await api.tags
|
||||||
|
.browse({
|
||||||
|
limit: 'all'
|
||||||
|
})
|
||||||
.include({ "count.posts": true })
|
.include({ "count.posts": true })
|
||||||
.fetch();
|
.paginate();
|
||||||
if (!results.success) {
|
|
||||||
throw new Error(results.errors.map((e) => e.message).join(", "));
|
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);
|
||||||
}
|
}
|
||||||
return {
|
return tags;
|
||||||
tags: results.data,
|
|
||||||
meta: results.meta,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getFeaturedPosts = async () => {
|
export const getFeaturedPosts = async () => {
|
||||||
|
|
|
@ -16,7 +16,7 @@ import satoriOG from "../../satori";
|
||||||
export const getStaticPaths: GetStaticPaths = async () => {
|
export const getStaticPaths: GetStaticPaths = async () => {
|
||||||
const result: GetStaticPathsItem[] = [];
|
const result: GetStaticPathsItem[] = [];
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, "Settings are required");
|
invariant(settings, "Settings are required");
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,19 @@ export const GhostUserConfigSchema = z.object({
|
||||||
/** OPTIONAL - Configure the Theme Provider
|
/** OPTIONAL - Configure the Theme Provider
|
||||||
* @ This option allows the user to configure the Theme Provider
|
* @ This option allows the user to configure the Theme Provider
|
||||||
*/
|
*/
|
||||||
ThemeProvider: z
|
ThemeProvider: z.object({
|
||||||
.object({
|
|
||||||
/** OPTIONAL - Disable the theme provider
|
/** OPTIONAL - Disable the theme provider
|
||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
disableThemeProvider: z.coerce.boolean(),
|
disableThemeProvider: z.coerce.boolean().default(false),
|
||||||
/** OPTIONAL - Set the theme you want to use
|
/** OPTIONAL - Set the theme you want to use
|
||||||
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
||||||
*/
|
*/
|
||||||
theme: z.string(),
|
theme: z.string().default("@matthiesenxyz/astro-ghostcms-theme-default"),
|
||||||
})
|
astroRemote: z.object({
|
||||||
.optional()
|
enable: z.boolean().default(true),
|
||||||
.default({
|
}).optional().default({}),
|
||||||
disableThemeProvider: false,
|
}).optional().default({}),
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default"
|
|
||||||
}),
|
|
||||||
/** Allows the user to disable the provided 404 page */
|
/** Allows the user to disable the provided 404 page */
|
||||||
disableDefault404: z.coerce.boolean().optional(),
|
disableDefault404: z.coerce.boolean().optional(),
|
||||||
/** Allows the user to disable the provided RSS Feed */
|
/** Allows the user to disable the provided RSS Feed */
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# @matthiesenxyz/create-astro-ghostcms
|
# @matthiesenxyz/create-astro-ghostcms
|
||||||
|
|
||||||
|
## 0.1.2
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- 4c1002a: fix getAllTags bug for themes and bump other packages deps
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/create-astro-ghostcms",
|
"name": "@matthiesenxyz/create-astro-ghostcms",
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"description": "Utility to quickly get started with our Integration and astro",
|
"description": "Utility to quickly get started with our Integration and astro",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./create-astro-ghostcms.mjs",
|
"main": "./create-astro-ghostcms.mjs",
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^11.0.1",
|
"@types/fs-extra": "^11.0.1",
|
||||||
"@types/gunzip-maybe": "^1.4.0",
|
"@types/gunzip-maybe": "^1.4.0",
|
||||||
"@types/node": "^20.11.25",
|
"@types/node": "^20.11.28",
|
||||||
"@types/tar-fs": "^2.0.1",
|
"@types/tar-fs": "^2.0.1",
|
||||||
"typescript": "^5.4.2"
|
"typescript": "^5.4.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
import type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
|
||||||
import DefaultPageLayout from "../../layouts/default.astro";
|
|
||||||
import PostPreview from "../../components/PostPreview.astro";
|
|
||||||
import { getAllPosts, getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
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 { getGhostImgPath } from "../../utils";
|
import { getGhostImgPath } from "../../utils";
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const posts = await getAllPosts();
|
const posts = await getAllPosts();
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
|
|
||||||
return tags.map((tag) => {
|
return tags.map((tag) => {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
---
|
---
|
||||||
import DefaultPageLayout from "../layouts/default.astro";
|
import { getAllTags, getSettings, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
||||||
import TagCard from "../components/TagCard.astro";
|
import TagCard from "../components/TagCard.astro";
|
||||||
import { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
import DefaultPageLayout from "../layouts/default.astro";
|
||||||
|
|
||||||
|
|
||||||
let title = "All Tags";
|
let title = "All Tags";
|
||||||
let description = "All the tags used so far...";
|
let description = "All the tags used so far...";
|
||||||
|
|
||||||
const { tags } = await getAllTags();
|
const tags = await getAllTags();
|
||||||
const settings = await getSettings();
|
const settings = await getSettings();
|
||||||
invariant(settings, "Settings not found");
|
invariant(settings, "Settings not found");
|
||||||
---
|
---
|
||||||
|
|
|
@ -1,5 +1,66 @@
|
||||||
# @matthiesenxyz/starlight-ghostcms
|
# @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
|
## 0.1.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
|
|
@ -49,7 +49,9 @@ export default defineConfig({
|
||||||
integrations: [
|
integrations: [
|
||||||
starlight({
|
starlight({
|
||||||
plugins: [
|
plugins: [
|
||||||
starlightGhostCMS()
|
starlightGhostCMS({
|
||||||
|
ghostURL: "https://ghostdemo.matthiesen.xyz"
|
||||||
|
})
|
||||||
],
|
],
|
||||||
title: 'My Docs',
|
title: 'My Docs',
|
||||||
}),
|
}),
|
||||||
|
@ -63,7 +65,7 @@ You must also create 2 environment variables in a `.env` file with the following
|
||||||
|
|
||||||
```env
|
```env
|
||||||
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
|
CONTENT_API_KEY=a33da3965a3a9fb2c6b3f63b48
|
||||||
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz
|
CONTENT_API_URL=https://ghostdemo.matthiesen.xyz // ghostURL option in `astro.config.mjs` will take priority. (This is fallback option)
|
||||||
GITHUB_PERSONAL_TOKEN=ghp_ //OPTIONAL - This is for Astro-Gists if you choose to use it!
|
GITHUB_PERSONAL_TOKEN=ghp_ //OPTIONAL - This is for Astro-Gists if you choose to use it!
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
import type { StarlightPlugin, StarlightUserConfig } from "@astrojs/starlight/types";
|
import type { StarlightPlugin, StarlightUserConfig } from "@astrojs/starlight/types";
|
||||||
import type { AstroIntegrationLogger } from "astro";
|
import type { AstroIntegrationLogger } from "astro";
|
||||||
import { type StarlightGhostConfig, validateConfig } from "./src/schemas/config";
|
import { type StarlightGhostConfig, validateConfig } from "./src/schemas/config";
|
||||||
import { facebook, getSettings, invariant, twitter } from "./src/utils/api";
|
|
||||||
import starlightGhostcms from "./src/integrations/starlight-ghostcms";
|
import starlightGhostcms from "./src/integrations/starlight-ghostcms";
|
||||||
|
|
||||||
const settings = await getSettings();
|
|
||||||
|
|
||||||
export type { StarlightGhostConfig };
|
export type { StarlightGhostConfig };
|
||||||
|
|
||||||
export default function starlightGhostCMS(
|
export default function starlightGhostCMS(
|
||||||
userConfig?: StarlightGhostConfig,
|
userConfig?: StarlightGhostConfig,
|
||||||
): StarlightPlugin {
|
): StarlightPlugin {
|
||||||
const config: StarlightGhostConfig = validateConfig(userConfig);
|
const config: StarlightGhostConfig = validateConfig(userConfig);
|
||||||
invariant(settings, "Settings not available... check your api key/url");
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: "@matthiesenxyz/starlight-ghostcms-plugin",
|
name: "@matthiesenxyz/starlight-ghostcms-plugin",
|
||||||
|
@ -32,8 +28,6 @@ export default function starlightGhostCMS(
|
||||||
social: {
|
social: {
|
||||||
...starlightConfig.social,
|
...starlightConfig.social,
|
||||||
...overrideRSS(starlightConfig.social, astroConfig.site),
|
...overrideRSS(starlightConfig.social, astroConfig.site),
|
||||||
...overrideTwitter(starlightConfig.social),
|
|
||||||
...overrideFacebook(starlightConfig.social),
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
...starlightConfig.components,
|
...starlightConfig.components,
|
||||||
|
@ -59,6 +53,7 @@ export default function starlightGhostCMS(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function overrideRSS(
|
function overrideRSS(
|
||||||
socials: StarlightUserConfig["social"],
|
socials: StarlightUserConfig["social"],
|
||||||
url: string | undefined
|
url: string | undefined
|
||||||
|
@ -68,26 +63,6 @@ function overrideRSS(
|
||||||
return { rss: `${url}/rss.xml` };
|
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(
|
function overrideStarlightComponent(
|
||||||
components: StarlightUserConfig["components"],
|
components: StarlightUserConfig["components"],
|
||||||
logger: AstroIntegrationLogger,
|
logger: AstroIntegrationLogger,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@matthiesenxyz/starlight-ghostcms",
|
"name": "@matthiesenxyz/starlight-ghostcms",
|
||||||
"description": "Starlight GhostCMS plugin to allow easier importing of GhostCMS Content into your starlight website",
|
"description": "Starlight GhostCMS plugin to allow easier importing of GhostCMS Content into your starlight website",
|
||||||
"version": "0.1.2",
|
"version": "0.1.9",
|
||||||
"homepage": "https://astro-ghostcms.xyz/",
|
"homepage": "https://astro-ghostcms.xyz/",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -54,20 +54,19 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@astrojs/starlight": "^0.21.1",
|
"@astrojs/starlight": "^0.21.1",
|
||||||
"astro": "^4.4.13",
|
"vitest": "^1.4.0",
|
||||||
"vitest": "^1.3.1",
|
|
||||||
"vitest-fetch-mock": "^0.2.2"
|
"vitest-fetch-mock": "^0.2.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/rss": "^4.0.5",
|
"@astrojs/rss": "^4.0.5",
|
||||||
"@matthiesenxyz/astro-gists": "^0.2.1",
|
"@matthiesenxyz/astro-gists": "^0.2.11",
|
||||||
"@ts-ghost/core-api": "^6.0.0",
|
"@ts-ghost/core-api": "^6.0.0",
|
||||||
"@ts-ghost/content-api": "^4.0.12",
|
"@ts-ghost/content-api": "^4.0.12",
|
||||||
"astro-integration-kit": "^0.5.1",
|
"astro-integration-kit": "^0.6.0",
|
||||||
"astro-remote": "^0.3.2",
|
"astro-remote": "^0.3.2",
|
||||||
"ultrahtml": "^1.5.3",
|
"ultrahtml": "^1.5.3",
|
||||||
"vite": "^5.1.5",
|
"vite": "^5.1.6",
|
||||||
"vite-tsconfig-paths": "^4.3.1"
|
"vite-tsconfig-paths": "^4.3.2"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@astrojs/starlight": ">=0.19.0",
|
"@astrojs/starlight": ">=0.19.0",
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
---
|
|
||||||
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}/>
|
|
|
@ -1 +0,0 @@
|
||||||
export { default as CodeSlot } from "./CodeSlot.astro";
|
|
|
@ -6,12 +6,17 @@ import { corePlugins } from "astro-integration-kit/plugins";
|
||||||
import { z } from "astro/zod";
|
import { z } from "astro/zod";
|
||||||
import { type StarlightGhostConfig } from "../schemas/config";
|
import { type StarlightGhostConfig } from "../schemas/config";
|
||||||
import astroGists from "@matthiesenxyz/astro-gists";
|
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({
|
export default defineIntegration({
|
||||||
name: "@matthiesenxyz/starlight-ghostcms",
|
name: "@matthiesenxyz/starlight-ghostcms",
|
||||||
optionsSchema: z.custom<StarlightGhostConfig>(),
|
optionsSchema: z.custom<StarlightGhostConfig>(),
|
||||||
plugins: [...corePlugins],
|
plugins: [...corePlugins],
|
||||||
setup({ options }) {
|
setup({ options, name }) {
|
||||||
const { resolve } = createResolver(import.meta.url);
|
const { resolve } = createResolver(import.meta.url);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -24,6 +29,23 @@ export default defineIntegration({
|
||||||
}) => {
|
}) => {
|
||||||
watchIntegration(resolve());
|
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
|
// Add the AstroGist integration if enabled
|
||||||
logger.info("Adding @matthiesenxyz/astro-gists integration ...");
|
logger.info("Adding @matthiesenxyz/astro-gists integration ...");
|
||||||
addIntegration(astroGists());
|
addIntegration(astroGists());
|
||||||
|
|
|
@ -6,7 +6,6 @@ import { getPageProps } from '../utils/page';
|
||||||
import { getAllPosts } from '../utils/api';
|
import { getAllPosts } from '../utils/api';
|
||||||
import Metadata from '../components/Metadata.astro';
|
import Metadata from '../components/Metadata.astro';
|
||||||
import { Markup } from 'astro-remote';
|
import { Markup } from 'astro-remote';
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
import * as Gists from '@matthiesenxyz/astro-gists/components';
|
import * as Gists from '@matthiesenxyz/astro-gists/components';
|
||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
|
@ -48,11 +47,9 @@ const pageProps = getPageProps(post.title)
|
||||||
<Markup
|
<Markup
|
||||||
content={post.html}
|
content={post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
allowComponents: true,
|
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={{
|
components={{
|
||||||
pre: render.CodeSlot,
|
|
||||||
getgist: Gists.GetGist,
|
getgist: Gists.GetGist,
|
||||||
getgistgroup: Gists.GetGistGroup,
|
getgistgroup: Gists.GetGistGroup,
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -6,29 +6,27 @@ import Page from '../components/Page.astro'
|
||||||
import { getPageProps } from '../utils/page'
|
import { getPageProps } from '../utils/page'
|
||||||
import { getSluggedPage } from '../utils/api'
|
import { getSluggedPage } from '../utils/api'
|
||||||
import { Markup } from 'astro-remote'
|
import { Markup } from 'astro-remote'
|
||||||
import * as render from '../components/astro-remote';
|
|
||||||
|
|
||||||
const aboutPage = await getSluggedPage("about");
|
const aboutPage = await getSluggedPage("about");
|
||||||
|
|
||||||
//const { entries, nextLink, prevLink } = Astro.props
|
//const { entries, nextLink, prevLink } = Astro.props
|
||||||
|
|
||||||
const pageProps = getPageProps(aboutPage?.post?.title)
|
const pageProps = getPageProps(aboutPage ? aboutPage.post.title : "")
|
||||||
---
|
---
|
||||||
|
|
||||||
<Page {...pageProps}>
|
<Page {...pageProps}>
|
||||||
{config.supportGhost && (
|
{config.supportGhost && (
|
||||||
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
|
<div id="pghost">Powered by <a href="https://ghost.org">Ghost</a></div>
|
||||||
)}
|
)}
|
||||||
|
{aboutPage &&
|
||||||
<Metadata entry={aboutPage.post} />
|
<Metadata entry={aboutPage.post} />
|
||||||
<Markup
|
<Markup
|
||||||
content={aboutPage.post.html}
|
content={aboutPage.post.html}
|
||||||
sanitize={{
|
sanitize={{
|
||||||
allowComponents: true,
|
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">
|
<footer class="not-content">
|
||||||
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
||||||
</footer>
|
</footer>
|
||||||
|
|
|
@ -3,6 +3,10 @@ import { z } from "astro/zod";
|
||||||
|
|
||||||
const configSchema = z
|
const configSchema = z
|
||||||
.object({
|
.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.
|
* The number of blog posts to display per page in the blog post list.
|
||||||
*/
|
*/
|
||||||
|
@ -31,8 +35,8 @@ const configSchema = z
|
||||||
* Turn on and off "Powered by Ghost"
|
* Turn on and off "Powered by Ghost"
|
||||||
*/
|
*/
|
||||||
supportGhost: z.boolean().default(true),
|
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 {
|
export function validateConfig(userConfig: unknown): StarlightGhostConfig {
|
||||||
const config = configSchema.safeParse(userConfig);
|
const config = configSchema.safeParse(userConfig);
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { Page, Post } from "./schemas";
|
||||||
|
|
||||||
// LOAD ENVIRONMENT VARIABLES
|
// LOAD ENVIRONMENT VARIABLES
|
||||||
import { loadEnv } from "vite";
|
import { loadEnv } from "vite";
|
||||||
//import StarlightGhostConfig from "virtual:starlight-ghostcms/config";
|
import config from "virtual:starlight-ghostcms/config";
|
||||||
|
|
||||||
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
||||||
"all",
|
"all",
|
||||||
|
@ -11,12 +11,9 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
||||||
"CONTENT_",
|
"CONTENT_",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//const ConfURL = StarlightGhostConfig.ghostURL || "";
|
|
||||||
|
|
||||||
// SETUP GHOST API
|
// SETUP GHOST API
|
||||||
const ghostApiKey = CONTENT_API_KEY || "";
|
const ghostApiKey = CONTENT_API_KEY || "";
|
||||||
const ghostUrl = CONTENT_API_URL || "";
|
const ghostUrl = config.ghostURL || CONTENT_API_URL || "";
|
||||||
const version = "v5.0";
|
const version = "v5.0";
|
||||||
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
|
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
|
||||||
|
|
||||||
|
@ -101,6 +98,15 @@ export const getAllPages = async () => {
|
||||||
return pages;
|
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) => {
|
export const getSluggedPage = async (slug:string) => {
|
||||||
const results = await api.pages
|
const results = await api.pages
|
||||||
.read({slug: slug})
|
.read({slug: slug})
|
||||||
|
@ -110,21 +116,16 @@ export const getSluggedPage = async (slug:string) => {
|
||||||
}).fetch()
|
}).fetch()
|
||||||
|
|
||||||
if (!results.success) {
|
if (!results.success) {
|
||||||
throw new Error(results.errors.map((e) => e.message).join(", "));
|
if (config.verbose === true){
|
||||||
|
console.log(`[Starlight-GhostCMS]: ${results.errors.map((e) => e.message).join(", ")}Resource: (${slug})`);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
post: results.data,
|
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 () => {
|
export const getAllTags = async () => {
|
||||||
const results = await api.tags
|
const results = await api.tags
|
||||||
.browse()
|
.browse()
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
import ghostcms from "@matthiesenxyz/astro-ghostcms";
|
import ghostcms from "@matthiesenxyz/astro-ghostcms";
|
||||||
import { defineConfig } from "astro/config";
|
import { defineConfig } from "astro/config";
|
||||||
///import tailwind from "@astrojs/tailwind";
|
// import tailwind from "@astrojs/tailwind";
|
||||||
//import UnoCSS from "unocss/astro";
|
// import UnoCSS from "unocss/astro";
|
||||||
|
|
||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: "https://demo.astro-ghostcms.xyz/",
|
site: "https://demo.astro-ghostcms.xyz/",
|
||||||
integrations: [
|
integrations: [
|
||||||
//tailwind(),
|
//tailwind(),
|
||||||
//UnoCSS({ injectReset: true }),
|
// UnoCSS({ injectReset: true }),
|
||||||
ghostcms({
|
ghostcms({
|
||||||
ghostURL: 'https://ghostdemo.matthiesen.xyz',
|
ghostURL: 'https://ghostdemo.matthiesen.xyz',
|
||||||
ThemeProvider: {
|
ThemeProvider: {
|
||||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
|
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||||
|
astroRemote: {
|
||||||
|
enable: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
verbose: true,
|
verbose: true,
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -11,18 +11,18 @@
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"astro": "^4.4.13",
|
"astro": "^4.5.6",
|
||||||
"@matthiesenxyz/astro-ghostcms": "workspace:*",
|
"@matthiesenxyz/astro-ghostcms": "workspace:*",
|
||||||
"@matthiesenxyz/astro-ghostcms-theme-default": "workspace:*",
|
"@matthiesenxyz/astro-ghostcms-theme-default": "workspace:*",
|
||||||
"@matthiesenxyz/astro-ghostcms-catppuccin": "workspace:*",
|
"@matthiesenxyz/astro-ghostcms-catppuccin": "workspace:*",
|
||||||
"@matthiesenxyz/astro-ghostcms-brutalbyelian": "workspace:*",
|
"@matthiesenxyz/astro-ghostcms-brutalbyelian": "workspace:*",
|
||||||
"@astrojs/tailwind": "^5.1.0",
|
"@astrojs/tailwind": "^5.1.0",
|
||||||
"@unocss/astro": "^0.58.5",
|
"@unocss/astro": "^0.58.6",
|
||||||
"tailwindcss": "^3.3.5"
|
"tailwindcss": "^3.3.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@unocss/reset": "^0.58.5",
|
"@unocss/reset": "^0.58.6",
|
||||||
"typescript": "^5.4.2",
|
"typescript": "^5.4.2",
|
||||||
"unocss": "^0.58.5"
|
"unocss": "^0.58.6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ export default defineConfig({
|
||||||
title: "My Docs",
|
title: "My Docs",
|
||||||
plugins: [
|
plugins: [
|
||||||
starlightGhostCMS({
|
starlightGhostCMS({
|
||||||
|
ghostURL: "https://ghostdemo.matthiesen.xyz",
|
||||||
title: "Demo Blog",
|
title: "Demo Blog",
|
||||||
rssDescription: "Starlight Playground",
|
rssDescription: "Starlight Playground",
|
||||||
route: "blog",
|
route: "blog",
|
||||||
|
|
|
@ -11,11 +11,14 @@
|
||||||
"preview": "astro preview",
|
"preview": "astro preview",
|
||||||
"astro": "astro"
|
"astro": "astro"
|
||||||
},
|
},
|
||||||
"devDependencies": {},
|
"devDependencies": {
|
||||||
|
"@types/node": "^20.11.28"
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@astrojs/starlight": "^0.21.1",
|
"@astrojs/starlight": "^0.21.1",
|
||||||
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
|
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
|
||||||
"astro": "^4.4.13",
|
"@matthiesenxyz/astro-gists": "^0.2.11",
|
||||||
|
"astro": "^4.5.6",
|
||||||
"sharp": "^0.33.2"
|
"sharp": "^0.33.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
2288
pnpm-lock.yaml
2288
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue