diff --git a/packages/starlight-ghostcms/astro.d.ts b/packages/starlight-ghostcms/astro.d.ts new file mode 100644 index 00000000..71e1f916 --- /dev/null +++ b/packages/starlight-ghostcms/astro.d.ts @@ -0,0 +1,17 @@ +declare module 'astro:content' { + export interface AstroCollectionEntry { + body: string + collection: string + data: TData + id: string + render: () => Promise<{ + Content: import('astro').MarkdownInstance['Content'] + }> + slug: string + } + + export function getCollection( + collection: string, + filter?: (entry: AstroCollectionEntry) => boolean, + ): Promise[]> + } \ No newline at end of file diff --git a/packages/starlight-ghostcms/index.ts b/packages/starlight-ghostcms/index.ts index aa9c553c..6ea9d24f 100644 --- a/packages/starlight-ghostcms/index.ts +++ b/packages/starlight-ghostcms/index.ts @@ -17,6 +17,7 @@ export default function starlightBlogPlugin(userConfig?: StarlightGhostConfig): ...starlightConfig.components, ...overrideStarlightComponent(starlightConfig.components, logger, 'MarkdownContent'), ...overrideStarlightComponent(starlightConfig.components, logger, 'Sidebar'), + ...overrideStarlightComponent(starlightConfig.components, logger, "SiteTitle"), } }) diff --git a/packages/starlight-ghostcms/package.json b/packages/starlight-ghostcms/package.json index 866936d2..24b5f005 100644 --- a/packages/starlight-ghostcms/package.json +++ b/packages/starlight-ghostcms/package.json @@ -32,22 +32,29 @@ "email": "issues@astro-ghostcms.xyz" }, "main": "index.ts", - "types": "types.d.ts", + "types": "index.ts", "files": [ "src", - ".env.demo", "index.ts", "tsconfig.json", "types.d.ts" ], "exports": { - ".": "./index.ts" + ".": "./index.ts", + "./overrides/MarkdownContent.astro": "./src/overrides/MarkdownContent.astro", + "./overrides/Sidebar.astro": "./src/overrides/SideBar.astro", + "./overrides/SiteTitle.astro": "./src/overrides/SiteTitle.astro", + "./routes/index.astro": "./src/routes/index.astro", + "./routes/[slug].astro": "./src/routes/[slug].astro", + "./schema": "./src/schemas/config.ts", + "./package.json": "./package.json" }, "scripts": { }, "devDependencies": { "@astrojs/starlight": "0.19.0", "@ts-ghost/core-api": "5.1.2", + "vite": "^5.1.2", "astro": "4.3.7" }, "peerdependencies": { diff --git a/packages/starlight-ghostcms/src/components/Metadata.astro b/packages/starlight-ghostcms/src/components/Metadata.astro index 946c61c9..792ca8f4 100644 --- a/packages/starlight-ghostcms/src/components/Metadata.astro +++ b/packages/starlight-ghostcms/src/components/Metadata.astro @@ -1,21 +1,21 @@ --- -import { getBlogEntryMetadata, type StarlightBlogEntry } from '../utils/content' +import type { Post } from '../schemas/posts' import Author from './Author.astro' interface Props { - entry: StarlightBlogEntry + entry: Post } const { entry } = Astro.props -const { authors, date } = getBlogEntryMetadata(entry) +const { authors, published_at, created_at } = entry -const hasAuthors = authors.length > 0 +const hasAuthors = authors !== undefined ---