Added WBArticle

This commit is contained in:
2025-11-19 09:35:58 +01:00
parent a7e27cc54a
commit b88532e089
6 changed files with 43 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
import { config } from '@keystatic/core';
import taxonomyCollections from '@/keystatic/collections/taxonomy';
import worldburnerCollections from '@/keystatic/collections/worldburner';
export default config({
storage: {
@@ -8,5 +9,6 @@ export default config({
},
collections: {
...taxonomyCollections,
...worldburnerCollections,
},
});

View File

@@ -0,0 +1,7 @@
import posts from '@/keystatic/collections/worldburner/posts';
const wbCollections = {
wb_posts: posts,
};
export default wbCollections;

View File

@@ -0,0 +1,16 @@
import { collection } from '@keystatic/core';
import { createArticleField } from '@/keystatic/fields/general/article';
export default collection({
label: 'WB Posts',
slugField: 'title',
path: 'content/worldburner/posts/*',
format: {
contentField: 'content',
},
entryLayout: 'content',
schema: {
...createArticleField('worldburner/posts', ''),
},
});

View File

@@ -0,0 +1,9 @@
import { cache, reader } from '@/lib/readers/base';
export const getWBPosts = cache(async () =>
reader.collections['wb_posts'].all()
);
export const getWBPostsBySlug = cache(async (slug: string) =>
reader.collections['wb_posts'].read(slug)
);

3
src/lib/types/content.ts Normal file
View File

@@ -0,0 +1,3 @@
import { WBContent } from '@/lib/types/worldburner';
export type ArticleContent = WBContent;

View File

@@ -0,0 +1,6 @@
import { Entry } from '@keystatic/core/reader';
import keystaticConfig from '~/keystatic.config';
export type WBPost = Entry<(typeof keystaticConfig.collections)['wb_posts']>;
export type WBContent = WBPost;