Added WBArticle
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import { config } from '@keystatic/core';
|
import { config } from '@keystatic/core';
|
||||||
|
|
||||||
import taxonomyCollections from '@/keystatic/collections/taxonomy';
|
import taxonomyCollections from '@/keystatic/collections/taxonomy';
|
||||||
|
import worldburnerCollections from '@/keystatic/collections/worldburner';
|
||||||
|
|
||||||
export default config({
|
export default config({
|
||||||
storage: {
|
storage: {
|
||||||
@@ -8,5 +9,6 @@ export default config({
|
|||||||
},
|
},
|
||||||
collections: {
|
collections: {
|
||||||
...taxonomyCollections,
|
...taxonomyCollections,
|
||||||
|
...worldburnerCollections,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
7
src/keystatic/collections/worldburner/index.ts
Normal file
7
src/keystatic/collections/worldburner/index.ts
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import posts from '@/keystatic/collections/worldburner/posts';
|
||||||
|
|
||||||
|
const wbCollections = {
|
||||||
|
wb_posts: posts,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default wbCollections;
|
||||||
16
src/keystatic/collections/worldburner/posts.ts
Normal file
16
src/keystatic/collections/worldburner/posts.ts
Normal 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', ''),
|
||||||
|
},
|
||||||
|
});
|
||||||
9
src/lib/readers/worldburner/posts.ts
Normal file
9
src/lib/readers/worldburner/posts.ts
Normal 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
3
src/lib/types/content.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import { WBContent } from '@/lib/types/worldburner';
|
||||||
|
|
||||||
|
export type ArticleContent = WBContent;
|
||||||
6
src/lib/types/worldburner.ts
Normal file
6
src/lib/types/worldburner.ts
Normal 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;
|
||||||
Reference in New Issue
Block a user