Compare commits
40 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 | |
github-actions[bot] | 81095d78b5 | |
create-issue-branch[bot] | 27241192af | |
Adam Matthiesen | b606fac02d | |
Adam Matthiesen | 827be67b2d | |
Adam Matthiesen | 5709e8706e | |
Adam Matthiesen | 18f99e9b58 | |
Adam Matthiesen | f57800a911 | |
Adam Matthiesen | 08561b74ca | |
Adam Matthiesen | 78c0a72040 | |
Adam Matthiesen | 487d6e49fd |
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
name: New Chore
|
||||
about: Used to create a new Chore for a needed task
|
||||
title: "Chore: [NAME]"
|
||||
labels: chore
|
||||
---
|
||||
|
||||
**Is your chore related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
|
@ -0,0 +1,38 @@
|
|||
branchName: 'issue-${issue.number}-${issue.title[0,32]}'
|
||||
gitReplaceChars: '/<>'
|
||||
autoLinkIssue: true
|
||||
openDraftPR: true
|
||||
prSkipCI: true
|
||||
copyIssueDescriptionToPR: true
|
||||
copyIssueLabelsToPR: true
|
||||
copyIssueAssigneeToPR: true
|
||||
copyIssueProjectsToPR: true
|
||||
copyIssueMilestoneToPR: true
|
||||
conventionalPrTitles: true
|
||||
conventionalLabels:
|
||||
fix:
|
||||
bug: '🐛'
|
||||
dependencies: '⬆️'
|
||||
security: '🔒'
|
||||
feat:
|
||||
enhancement: '✨'
|
||||
new-stuff: '🚀'
|
||||
build:
|
||||
build: '🔧'
|
||||
chore:
|
||||
chore: '♻️'
|
||||
ci:
|
||||
ci: '👷'
|
||||
docs:
|
||||
documentation: '📝'
|
||||
style:
|
||||
style: '💎'
|
||||
refactor:
|
||||
refactor: '♻️'
|
||||
perf:
|
||||
performance: '⚡️'
|
||||
test:
|
||||
test: '✅'
|
||||
breaking:
|
||||
breaking-change: '💥'
|
||||
breaking change: '💥'
|
|
@ -26,13 +26,13 @@ jobs:
|
|||
- name: Setup npmrc
|
||||
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
|
||||
- name: install dependencies
|
||||
run: pnpm install
|
||||
run: pnpm install --no-frozen-lockfile
|
||||
- name: create and publish versions
|
||||
uses: matthiesenxyz/changeset@v1
|
||||
with:
|
||||
version: pnpm ci:version
|
||||
commit: "chore: update versions"
|
||||
title: "Chore: Ready for Release"
|
||||
title: "👷 [ci]: Ready for Release"
|
||||
publish: pnpm ci:publish
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
@ -14,4 +14,4 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- 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
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- uses: jauderho/git-repo-sync@63782025e80e84c48b25a1ee6bb9a22a3bd570d3
|
||||
- uses: MatthiesenXYZ/git-sync-action@v1.1
|
||||
with:
|
||||
# Such as https://github.com/wangchucheng/git-repo-sync.git
|
||||
target-url: ${{ secrets.GITLAB_URL }}
|
||||
|
|
|
@ -36,7 +36,6 @@ 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
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
"test:starlight:coverage": "pnpm --filter starlight-ghostcms test:coverage"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@biomejs/biome": "1.5.3",
|
||||
"@biomejs/biome": "1.6.1",
|
||||
"@changesets/cli": "^2.27.1",
|
||||
"@vitest/ui": "^1.3.1",
|
||||
"vitest": "^1.3.1",
|
||||
"@vitest/ui": "^1.4.0",
|
||||
"vitest": "^1.4.0",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,61 @@
|
|||
# @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
|
||||
|
||||
- 2724119: Migrate from `astro-ghostcms-rendercontent` to `astro-remote` for internal processing of GhostCMS HTML. no user changes required.
|
||||
|
||||
## 0.0.12
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/astro-ghostcms-brutalbyelian",
|
||||
"description": "ElianCodes Brutal theme modified to work with Astro-GhostCMS",
|
||||
"version": "0.0.12",
|
||||
"version": "0.0.18",
|
||||
"homepage": "https://astro-ghostcms.xyz/",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
@ -42,29 +42,27 @@
|
|||
},
|
||||
"scripts": {},
|
||||
"peerDependencies": {
|
||||
"astro": "^4.2.0"
|
||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||
"astro": ">=4.4.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/parser": "^7.1.1",
|
||||
"@typescript-eslint/parser": "^7.2.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-plugin-astro": "^0.31.4",
|
||||
"eslint-plugin-jsx-a11y": "^6.8.0",
|
||||
"prettier-plugin-astro": "^0.13.0",
|
||||
"prettier": "^3.2.5",
|
||||
"@matthiesenxyz/astro-ghostcms": "workspace:*",
|
||||
"@matthiesenxyz/astro-ghostcms-rendercontent": "workspace:*"
|
||||
"prettier": "^3.2.5"
|
||||
},
|
||||
"dependencies": {
|
||||
"@eliancodes/brutal-ui": "^0.2.6",
|
||||
"@iconify-json/logos": "^1.1.41",
|
||||
"@iconify-json/uil": "^1.1.8",
|
||||
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
|
||||
"@matthiesenxyz/astro-ghostcms-rendercontent": "^0.0.8",
|
||||
"@unocss/astro": "^0.58.5",
|
||||
"@unocss/reset": "^0.58.5",
|
||||
"unocss": "^0.58.5",
|
||||
"@eliancodes/brutal-ui": "^0.2.6",
|
||||
"astro-font": "^0.0.77",
|
||||
"@unocss/astro": "^0.58.6",
|
||||
"@unocss/reset": "^0.58.6",
|
||||
"astro-font": "^0.0.78",
|
||||
"astro-remote": "0.3.2",
|
||||
"typescript": "^5.4.2",
|
||||
"ultrahtml": "^1.5.3"
|
||||
"ultrahtml": "^1.5.3",
|
||||
"unocss": "^0.58.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
---
|
||||
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;
|
||||
|
@ -22,5 +27,8 @@ const { image, alt, caption = "", settings, transitionName } = Astro.props as Pr
|
|||
alt={alt}
|
||||
transition:name={transitionName}
|
||||
/>
|
||||
{caption && <figcaption class="text-ctp-overlay2"><Fragment set:html={caption}></figcaption>}
|
||||
{caption && (
|
||||
<figcaption class="text-ctp-overlay2">
|
||||
{useRemote ? <Markup content={caption} /> : <Fragment set:html={caption} />}
|
||||
</figcaption>)}
|
||||
</figure>
|
||||
|
|
|
@ -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"}/>
|
|
@ -4,6 +4,5 @@ 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";
|
||||
|
|
|
@ -4,9 +4,12 @@ import { getAllPosts, getAllPages, getSettings, invariant } from "@matthiesenxyz
|
|||
import type { InferGetStaticPropsType } from "astro";
|
||||
import RecentBlogPosts from "../components/generic/RecentBlogPosts.astro";
|
||||
import BlogPostHeader from "../components/blog/BlogPostHeader.astro";
|
||||
import { GhostRender } from "@matthiesenxyz/astro-ghostcms-rendercontent";
|
||||
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()]);
|
||||
|
@ -30,8 +33,12 @@ invariant(settings, "Settings are required");
|
|||
|
||||
<div class="my-5"/>
|
||||
<div id="ghost">
|
||||
<GhostRender
|
||||
{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'],
|
||||
}}
|
||||
components={{
|
||||
h1: C.H1,
|
||||
h2: C.H2,
|
||||
|
@ -39,11 +46,10 @@ 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>
|
||||
|
|
|
@ -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) => {
|
||||
|
|
|
@ -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;
|
||||
|
@ -16,7 +16,7 @@ const description = settings.description;
|
|||
description={description}
|
||||
>
|
||||
<main class='bg-pink p-6'>
|
||||
{
|
||||
{
|
||||
tags
|
||||
.filter((tag) => tag.slug && !tag.slug.startsWith("hash-"))
|
||||
.map((tag) => (
|
||||
|
|
|
@ -1,5 +1,42 @@
|
|||
# @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
|
||||
|
||||
- 2724119: Migrate to `astro-remote` for internal processing of GhostCMS HTML. No user changes required.
|
||||
|
||||
## 0.0.9
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/astro-ghostcms-catppuccin",
|
||||
"description": "A dark theme made with Catppuccin and TailwindCSS for Astro-GhostCMS",
|
||||
"version": "0.0.9",
|
||||
"version": "0.0.14",
|
||||
"homepage": "https://astro-ghostcms.xyz/",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
@ -50,7 +50,8 @@
|
|||
},
|
||||
"scripts": {},
|
||||
"peerDependencies": {
|
||||
"astro": "^4.2.1"
|
||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||
"astro": ">=4.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@matthiesenxyz/astro-ghostcms": "workspace:*"
|
||||
|
@ -59,10 +60,12 @@
|
|||
"@astrojs/tailwind": "^5.1.0",
|
||||
"@catppuccin/tailwindcss": "0.1.6",
|
||||
"@fontsource-variable/inter": "^5.0.17",
|
||||
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
|
||||
"@matthiesenxyz/astro-ghostcms": "^3.3.5",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"tailwindcss": "^3.3.5",
|
||||
"astro-navbar": "^2.3.1",
|
||||
"astro-seo": "^0.8.3"
|
||||
"astro-remote": "^0.3.2",
|
||||
"astro-seo": "^0.8.3",
|
||||
"tailwindcss": "^3.3.5",
|
||||
"ultrahtml": "1.5.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,11 @@ import type { Settings, Post } from "@matthiesenxyz/astro-ghostcms/api";
|
|||
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;
|
||||
|
||||
export type Props = {
|
||||
posts: Post[];
|
||||
settings: Settings;
|
||||
|
@ -59,7 +64,15 @@ const latestFeatured = posts[0]
|
|||
</div>
|
||||
<div class="divider my-4"/>
|
||||
<section id="ghostimport" class="text-ctp-subtext1">
|
||||
{latestFeatured && <Fragment set:html={latestFeatured.html} />}
|
||||
|
||||
|
||||
{useRemote ? (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'],
|
||||
}}
|
||||
/>) : (latestFeatured && <Fragment set:html={latestFeatured.html} />) }
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
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;
|
||||
|
||||
export type Props = {
|
||||
post: Post;
|
||||
settings: Settings;
|
||||
|
@ -14,10 +19,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 featured = featuredPosts.posts[0]
|
||||
return fposts.filter((p: Post)=>p.id !== featured.id)
|
||||
|
||||
}
|
||||
|
||||
const mPosts = await getPostsSet()
|
||||
|
@ -27,7 +32,15 @@ invariant(settings, "Settings not found");
|
|||
|
||||
<PostHero post={post} settings={settings} />
|
||||
<div id="ghostimport" class="mt-4 text-ctp-subtext1">
|
||||
<Fragment set:html={post.html} />
|
||||
{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'],
|
||||
}}
|
||||
/>
|
||||
) : <Fragment set:html={post.html} /> }
|
||||
</div>
|
||||
<PostFooter post={post} settings={settings} posts={mPosts} />
|
||||
|
||||
|
|
|
@ -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) => {
|
||||
|
@ -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}>
|
||||
<Container>
|
||||
<section class="post-card post-card-large">
|
||||
|
||||
|
||||
<div class="post-card-content">
|
||||
<div class="post-card-content-link">
|
||||
<header class="post-card-header">
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
# @matthiesenxyz/astro-ghostcms-rendercontent
|
||||
|
||||
## 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,33 +0,0 @@
|
|||
# Astro GhostCMS Content API HTML Processor
|
||||
|
||||
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.8",
|
||||
"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,61 @@
|
|||
# @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
|
||||
|
||||
- 2724119: Migrate to `astro-remote` for internal processing of GhostCMS HTML. No user changes required.
|
||||
|
||||
## 0.1.14
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||
"description": "Default Theme for astro-ghostcms",
|
||||
"version": "0.1.14",
|
||||
"version": "0.1.20",
|
||||
"homepage": "https://astro-ghostcms.xyz/",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
@ -43,15 +43,17 @@
|
|||
"scripts": {},
|
||||
"devDependencies": {
|
||||
"@matthiesenxyz/astro-ghostcms": "*",
|
||||
"@astrojs/check": "^0.5.6",
|
||||
"@astrojs/check": "^0.5.9",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"astro": "^4.2.1"
|
||||
"@matthiesenxyz/astro-ghostcms": ">=3.3.5",
|
||||
"astro": ">=4.4.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@matthiesenxyz/astro-ghostcms": "^3.3.1",
|
||||
"astro-font": "^0.0.77",
|
||||
"sass": "^1.71.1"
|
||||
"astro-font": "^0.0.78",
|
||||
"astro-remote": "^0.3.2",
|
||||
"sass": "^1.72.0",
|
||||
"ultrahtml": "^1.5.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
---
|
||||
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;
|
||||
|
||||
export type Props = {
|
||||
page: Page;
|
||||
settings: Settings;
|
||||
|
@ -24,7 +29,15 @@ const { page, settings, pageClass } = Astro.props as Props;
|
|||
|
||||
<section class="gh-content gh-canvas">
|
||||
<h1 class="article-title">{page.title}</h1>
|
||||
<Fragment set:html={page.html} />
|
||||
{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'],
|
||||
}}
|
||||
/>
|
||||
) : <Fragment set:html={page.html} /> }
|
||||
</section>
|
||||
</article>
|
||||
</main>
|
||||
|
|
|
@ -2,6 +2,11 @@
|
|||
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;
|
||||
|
||||
export type Props = {
|
||||
post: Post;
|
||||
settings: Settings;
|
||||
|
@ -16,7 +21,15 @@ invariant(settings, "Settings not found");
|
|||
<article class={`article post ${postClass}`}>
|
||||
<PostHero post={post} settings={settings} />
|
||||
<section class="gh-content gh-canvas">
|
||||
<Fragment set:html={post.html} />
|
||||
{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'],
|
||||
}}
|
||||
/>
|
||||
) : <Fragment set:html={post.html} /> }
|
||||
</section>
|
||||
</article>
|
||||
<PostFooter post={post} settings={settings} posts={posts} />
|
||||
|
|
|
@ -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 type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
||||
import PostPreview from "../../components/PostPreview.astro";
|
||||
import DefaultPageLayout from "../../layouts/default.astro";
|
||||
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) => {
|
||||
|
|
|
@ -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 { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
||||
import DefaultPageLayout from "../layouts/default.astro";
|
||||
|
||||
|
||||
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");
|
||||
---
|
||||
|
|
|
@ -1,5 +1,46 @@
|
|||
# @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
|
||||
|
|
|
@ -66,6 +66,9 @@ 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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/astro-ghostcms",
|
||||
"description": "Astro GhostCMS integration to allow easier importing of GhostCMS Content",
|
||||
"version": "3.3.1",
|
||||
"version": "3.3.5",
|
||||
"homepage": "https://astro-ghostcms.xyz/",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
@ -61,24 +61,24 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.11.25",
|
||||
"vitest": "^1.3.1",
|
||||
"@types/node": "^20.11.28",
|
||||
"vitest": "^1.4.0",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@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",
|
||||
"@ts-ghost/core-api": "^6.0.0",
|
||||
"@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",
|
||||
"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.5"
|
||||
"vite": "^5.1.6"
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
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
|
||||
import { loadEnv } from "vite";
|
||||
|
@ -94,17 +94,20 @@ export const getSettings = async () => {
|
|||
};
|
||||
|
||||
export const getAllTags = async () => {
|
||||
const results = await api.tags
|
||||
.browse()
|
||||
const tags: Tag[] = [];
|
||||
let cursor = await api.tags
|
||||
.browse({
|
||||
limit: 'all'
|
||||
})
|
||||
.include({ "count.posts": true })
|
||||
.fetch();
|
||||
if (!results.success) {
|
||||
throw new Error(results.errors.map((e) => e.message).join(", "));
|
||||
.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);
|
||||
}
|
||||
return {
|
||||
tags: results.data,
|
||||
meta: results.meta,
|
||||
};
|
||||
return tags;
|
||||
};
|
||||
|
||||
export const getFeaturedPosts = async () => {
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -17,22 +17,19 @@ 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(),
|
||||
disableThemeProvider: z.coerce.boolean().default(false),
|
||||
/** OPTIONAL - Set the theme you want to use
|
||||
* @default "@matthiesenxyz/astro-ghostcms-theme-default"
|
||||
*/
|
||||
theme: z.string(),
|
||||
})
|
||||
.optional()
|
||||
.default({
|
||||
disableThemeProvider: false,
|
||||
theme: "@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({}),
|
||||
/** Allows the user to disable the provided 404 page */
|
||||
disableDefault404: z.coerce.boolean().optional(),
|
||||
/** Allows the user to disable the provided RSS Feed */
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# @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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@matthiesenxyz/create-astro-ghostcms",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"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.25",
|
||||
"@types/node": "^20.11.28",
|
||||
"@types/tar-fs": "^2.0.1",
|
||||
"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 type { InferGetStaticParamsType, InferGetStaticPropsType } from 'astro';
|
||||
import PostPreview from "../../components/PostPreview.astro";
|
||||
import DefaultPageLayout from "../../layouts/default.astro";
|
||||
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) => {
|
||||
|
|
|
@ -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 { getSettings, getAllTags, invariant } from "@matthiesenxyz/astro-ghostcms/api";
|
||||
import DefaultPageLayout from "../layouts/default.astro";
|
||||
|
||||
|
||||
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");
|
||||
---
|
||||
|
|
|
@ -1,5 +1,72 @@
|
|||
# @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
|
||||
|
||||
- 2724119: Migrate to `astro-remote` for internal processing of GhostCMS HTML. No user changes required.
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
|
|
@ -49,7 +49,9 @@ export default defineConfig({
|
|||
integrations: [
|
||||
starlight({
|
||||
plugins: [
|
||||
starlightGhostCMS()
|
||||
starlightGhostCMS({
|
||||
ghostURL: "https://ghostdemo.matthiesen.xyz"
|
||||
})
|
||||
],
|
||||
title: 'My Docs',
|
||||
}),
|
||||
|
@ -63,7 +65,8 @@ 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
|
||||
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!
|
||||
```
|
||||
|
||||
**When you deploy your install dont forget to set the above ENVIRONMENT VARIABLES on your provider!**
|
||||
|
|
|
@ -1,24 +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 StarlightGhostConfig,
|
||||
validateConfig,
|
||||
} from "./src/schemas/config";
|
||||
import { facebook, getSettings, invariant, twitter } from "./src/utils/api";
|
||||
import { type StarlightGhostConfig, validateConfig } from "./src/schemas/config";
|
||||
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",
|
||||
|
@ -32,14 +22,12 @@ export default function starlightGhostCMS(
|
|||
}) {
|
||||
// Add the Starlight-GhostCMS integration
|
||||
addIntegration(starlightGhostcms(config));
|
||||
|
||||
|
||||
// Update the Starlight config with the GhostCMS config
|
||||
updateStarlightConfig({
|
||||
social: {
|
||||
...starlightConfig.social,
|
||||
...overrideRSS(starlightConfig.social, astroConfig.site),
|
||||
...overrideTwitter(starlightConfig.social),
|
||||
...overrideFacebook(starlightConfig.social),
|
||||
},
|
||||
components: {
|
||||
...starlightConfig.components,
|
||||
|
@ -65,6 +53,7 @@ export default function starlightGhostCMS(
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
function overrideRSS(
|
||||
socials: StarlightUserConfig["social"],
|
||||
url: string | undefined
|
||||
|
@ -74,26 +63,6 @@ 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,
|
||||
|
|
|
@ -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.1",
|
||||
"version": "0.1.9",
|
||||
"homepage": "https://astro-ghostcms.xyz/",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
|
@ -54,17 +54,19 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@astrojs/starlight": "^0.21.1",
|
||||
"astro": "^4.4.13",
|
||||
"vitest": "^1.3.1",
|
||||
"vitest": "^1.4.0",
|
||||
"vitest-fetch-mock": "^0.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/rss": "^4.0.5",
|
||||
"@matthiesenxyz/astro-gists": "^0.2.11",
|
||||
"@ts-ghost/core-api": "^6.0.0",
|
||||
"@ts-ghost/content-api": "^4.0.12",
|
||||
"astro-integration-kit": "^0.5.1",
|
||||
"vite": "^5.1.5",
|
||||
"vite-tsconfig-paths": "^4.3.1"
|
||||
"astro-integration-kit": "^0.6.0",
|
||||
"astro-remote": "^0.3.2",
|
||||
"ultrahtml": "^1.5.3",
|
||||
"vite": "^5.1.6",
|
||||
"vite-tsconfig-paths": "^4.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@astrojs/starlight": ">=0.19.0",
|
||||
|
|
|
@ -64,7 +64,7 @@ const { author } = Astro.props
|
|||
img {
|
||||
border: 1px solid var(--sl-color-gray-2);
|
||||
border-radius: 9999px;
|
||||
height: 10rem;
|
||||
width: 10rem;
|
||||
height: 6rem;
|
||||
width: 6rem;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
---
|
||||
import type { Author } from '../schemas/authors'
|
||||
import config from 'virtual:starlight-ghostcms/config';
|
||||
|
||||
interface Props {
|
||||
author: Author
|
||||
|
@ -11,7 +12,7 @@ const isLink = author.slug !== undefined
|
|||
const Element = isLink ? 'a' : 'div'
|
||||
---
|
||||
|
||||
<Element href={isLink ? '/blog/authors' : undefined} class="author">
|
||||
<Element href={isLink ? `/${config.route}/authors` : undefined} class="author">
|
||||
{author.profile_image && <img alt={author.name} src={author.profile_image} />}
|
||||
<div class="text">
|
||||
<div class="name">{author.name}</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
import type { Post } from '../schemas/posts'
|
||||
import Metadata from './Metadata.astro'
|
||||
import config from 'virtual:starlight-ghostcms/config';
|
||||
|
||||
interface Props {
|
||||
entry: Post
|
||||
|
@ -14,7 +15,7 @@ const Excerpt = entry.excerpt
|
|||
<article class="preview">
|
||||
<header>
|
||||
<h2>
|
||||
<a href={`/blog/${entry.slug}`}>{entry.title}</a>
|
||||
<a href={`/${config.route}/${entry.slug}`}>{entry.title}</a>
|
||||
</h2>
|
||||
<Metadata entry={entry} />
|
||||
</header>
|
||||
|
|
|
@ -5,22 +5,52 @@ import {
|
|||
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 }) {
|
||||
setup({ options, name }) {
|
||||
const { resolve } = createResolver(import.meta.url);
|
||||
|
||||
return {
|
||||
"astro:config:setup": ({
|
||||
watchIntegration,
|
||||
addVirtualImports,
|
||||
injectRoute
|
||||
injectRoute,
|
||||
logger,
|
||||
addIntegration,
|
||||
}) => {
|
||||
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());
|
||||
logger.info("Note: If you are using Astro-Gists with GhostCMS Make sure to set the `GITHUB_PERSONAL_TOKEN` in your `.env` file. \n Otherwise, you can ignore any error messages related to Astro-Gists.")
|
||||
|
||||
addVirtualImports({
|
||||
'virtual:starlight-ghostcms/config': `export default ${JSON.stringify(options)}`,
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import StarlightMarkdownContent from '@astrojs/starlight/components/MarkdownContent.astro'
|
||||
import type { Props } from '@astrojs/starlight/props'
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import { isAnyBlogPostPage } from '../utils/page'
|
||||
import Metadata from '../components/Metadata.astro'
|
||||
import type { Post } from '../schemas/posts'
|
||||
|
||||
|
@ -11,7 +10,6 @@ export function checkpath(path: string){
|
|||
}
|
||||
|
||||
const isBlog = checkpath(Astro.url.pathname)
|
||||
const isBlogPost = isAnyBlogPostPage(Astro.props.slug)
|
||||
let blogEntry: Post | undefined = undefined
|
||||
|
||||
---
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
---
|
||||
import config from 'virtual:starlight-ghostcms/config'
|
||||
import config from 'virtual:starlight-ghostcms/config';
|
||||
import { Image } from "astro:assets";
|
||||
import Page from '../components/Page.astro'
|
||||
import { getPageProps } from '../utils/page'
|
||||
import { getAllPosts } from '../utils/api'
|
||||
import Metadata from '../components/Metadata.astro'
|
||||
|
||||
import Page from '../components/Page.astro';
|
||||
import { getPageProps } from '../utils/page';
|
||||
import { getAllPosts } from '../utils/api';
|
||||
import Metadata from '../components/Metadata.astro';
|
||||
import { Markup } from 'astro-remote';
|
||||
import * as Gists from '@matthiesenxyz/astro-gists/components';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getAllPosts();
|
||||
|
@ -36,13 +37,23 @@ const pageProps = getPageProps(post.title)
|
|||
height={800}
|
||||
/>
|
||||
<figcaption>
|
||||
<Fragment set:html={post.feature_image_caption} />
|
||||
<Markup content={post.feature_image_caption? post.feature_image_caption : "<div />"} />
|
||||
</figcaption>
|
||||
</figure>
|
||||
)}
|
||||
</header>
|
||||
<br />
|
||||
<Fragment set:html={post.html} />
|
||||
|
||||
<Markup
|
||||
content={post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
}}
|
||||
components={{
|
||||
getgist: Gists.GetGist,
|
||||
getgistgroup: Gists.GetGistGroup,
|
||||
}}
|
||||
/>
|
||||
|
||||
<footer class="not-content">
|
||||
</footer>
|
||||
|
|
|
@ -5,20 +5,28 @@ import Page from '../components/Page.astro'
|
|||
//import PrevNextLinks from '../components/PrevNextLinks.astro'
|
||||
import { getPageProps } from '../utils/page'
|
||||
import { getSluggedPage } from '../utils/api'
|
||||
import { Markup } from 'astro-remote'
|
||||
|
||||
const aboutPage = await getSluggedPage("about");
|
||||
|
||||
//const { entries, nextLink, prevLink } = Astro.props
|
||||
|
||||
const pageProps = getPageProps(aboutPage?.post?.title)
|
||||
const pageProps = getPageProps(aboutPage ? 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} />
|
||||
<Fragment set:html={aboutPage.post.html} />
|
||||
<Markup
|
||||
content={aboutPage.post.html}
|
||||
sanitize={{
|
||||
allowComponents: true,
|
||||
}}
|
||||
/>
|
||||
}
|
||||
<footer class="not-content">
|
||||
<!--PrevNextLinks next={nextLink} prev={prevLink} /-->
|
||||
</footer>
|
||||
|
|
|
@ -3,6 +3,10 @@ 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.
|
||||
*/
|
||||
|
@ -31,8 +35,8 @@ const configSchema = z
|
|||
* Turn on and off "Powered by Ghost"
|
||||
*/
|
||||
supportGhost: z.boolean().default(true),
|
||||
})
|
||||
.default({ postCount: 5, recentPostCount: 10, route: "blog", title: "Blog", rssDescription: "My Awesome Starlight-GhostCMS Blog", supportGhost: true});
|
||||
verbose: z.boolean().default(false),
|
||||
});
|
||||
|
||||
export function validateConfig(userConfig: unknown): StarlightGhostConfig {
|
||||
const config = configSchema.safeParse(userConfig);
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { Page, Post } from "./schemas";
|
|||
|
||||
// LOAD ENVIRONMENT VARIABLES
|
||||
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(
|
||||
"all",
|
||||
|
@ -11,12 +11,9 @@ const { CONTENT_API_KEY, CONTENT_API_URL } = loadEnv(
|
|||
"CONTENT_",
|
||||
);
|
||||
|
||||
|
||||
//const ConfURL = StarlightGhostConfig.ghostURL || "";
|
||||
|
||||
// SETUP GHOST API
|
||||
const ghostApiKey = CONTENT_API_KEY || "";
|
||||
const ghostUrl = CONTENT_API_URL || "";
|
||||
const ghostUrl = config.ghostURL || CONTENT_API_URL || "";
|
||||
const version = "v5.0";
|
||||
const api = new TSGhostContentAPI(ghostUrl, ghostApiKey, version);
|
||||
|
||||
|
@ -101,6 +98,15 @@ 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})
|
||||
|
@ -110,21 +116,16 @@ export const getSluggedPage = async (slug:string) => {
|
|||
}).fetch()
|
||||
|
||||
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 {
|
||||
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()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import config from 'virtual:starlight-ghostcms/config'
|
||||
|
||||
export function isBlogRoot(slug: string) {
|
||||
return slug === "blog";
|
||||
return slug === `${config.route}`;
|
||||
}
|
||||
|
||||
export function isAnyBlogPostPage(slug: string) {
|
||||
|
@ -15,7 +15,7 @@ export function isBlogPostPage(slug: string, postSlug: string) {
|
|||
}
|
||||
|
||||
export function isBlogTagsPage(slug: string, tag: string) {
|
||||
return slug === `blog/tags/${tag}`;
|
||||
return slug === `${config.route}/tags/${tag}`;
|
||||
}
|
||||
|
||||
export function getPageProps(title: string): StarlightPageProps {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
{
|
||||
"extends": "astro/tsconfigs/strict"
|
||||
"extends": "astro/tsconfigs/strictest",
|
||||
"compilerOptions": {
|
||||
"jsx": "preserve"
|
||||
}
|
||||
}
|
|
@ -1,18 +1,21 @@
|
|||
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-brutalbyelian",
|
||||
theme: "@matthiesenxyz/astro-ghostcms-theme-default",
|
||||
astroRemote: {
|
||||
enable: true,
|
||||
},
|
||||
},
|
||||
verbose: true,
|
||||
}),
|
||||
|
|
|
@ -11,17 +11,18 @@
|
|||
"astro": "astro"
|
||||
},
|
||||
"dependencies": {
|
||||
"astro": "^4.4.13",
|
||||
"astro": "^4.5.6",
|
||||
"@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.5",
|
||||
"@unocss/astro": "^0.58.6",
|
||||
"tailwindcss": "^3.3.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@unocss/reset": "^0.58.5",
|
||||
"@unocss/reset": "^0.58.6",
|
||||
"typescript": "^5.4.2",
|
||||
"unocss": "^0.58.5"
|
||||
"unocss": "^0.58.6"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ export default defineConfig({
|
|||
title: "My Docs",
|
||||
plugins: [
|
||||
starlightGhostCMS({
|
||||
ghostURL: "https://ghostdemo.matthiesen.xyz",
|
||||
title: "Demo Blog",
|
||||
rssDescription: "Starlight Playground",
|
||||
route: "blog",
|
||||
|
|
|
@ -11,11 +11,14 @@
|
|||
"preview": "astro preview",
|
||||
"astro": "astro"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.28"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/starlight": "^0.21.1",
|
||||
"@matthiesenxyz/starlight-ghostcms": "workspace:*",
|
||||
"astro": "^4.4.13",
|
||||
"@matthiesenxyz/astro-gists": "^0.2.11",
|
||||
"astro": "^4.5.6",
|
||||
"sharp": "^0.33.2"
|
||||
}
|
||||
}
|
2883
pnpm-lock.yaml
2883
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue