@hello-better/sanity-blog 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/core/types/options.d.ts +54 -0
  2. package/dist/core/types/options.d.ts.map +1 -0
  3. package/dist/core/types/options.js +2 -0
  4. package/dist/core/types/options.js.map +1 -0
  5. package/dist/index.d.ts +8 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +7 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/plugin.d.ts +28 -0
  10. package/dist/plugin.d.ts.map +1 -0
  11. package/dist/plugin.js +49 -0
  12. package/dist/plugin.js.map +1 -0
  13. package/dist/schema/blocks/blogBlock.d.ts +33 -0
  14. package/dist/schema/blocks/blogBlock.d.ts.map +1 -0
  15. package/dist/schema/blocks/blogBlock.js +123 -0
  16. package/dist/schema/blocks/blogBlock.js.map +1 -0
  17. package/dist/schema/documents/blogPost.d.ts +36 -0
  18. package/dist/schema/documents/blogPost.d.ts.map +1 -0
  19. package/dist/schema/documents/blogPost.js +171 -0
  20. package/dist/schema/documents/blogPost.js.map +1 -0
  21. package/dist/schema/documents/blogStream.d.ts +30 -0
  22. package/dist/schema/documents/blogStream.d.ts.map +1 -0
  23. package/dist/schema/documents/blogStream.js +54 -0
  24. package/dist/schema/documents/blogStream.js.map +1 -0
  25. package/dist/schema/documents/blogTag.d.ts +30 -0
  26. package/dist/schema/documents/blogTag.d.ts.map +1 -0
  27. package/dist/schema/documents/blogTag.js +39 -0
  28. package/dist/schema/documents/blogTag.js.map +1 -0
  29. package/dist/structure/blogStructure.d.ts +14 -0
  30. package/dist/structure/blogStructure.d.ts.map +1 -0
  31. package/dist/structure/blogStructure.js +41 -0
  32. package/dist/structure/blogStructure.js.map +1 -0
  33. package/package.json +35 -0
  34. package/readme.md +23 -0
@@ -0,0 +1,54 @@
1
+ import type { FieldDefinition } from 'sanity';
2
+ import type { SanityCoreOptions } from '@hello-better/sanity-core';
3
+ export type SanityBlogOptions = SanityCoreOptions & {
4
+ blogStreamTypeName?: string;
5
+ blogPostTypeName?: string;
6
+ blogTagTypeName?: string;
7
+ blogBlockTypeName?: string;
8
+ /** Include the Blog Tag document type. Default: true */
9
+ includeBlogTag?: boolean;
10
+ /** Include the Blog Stream document type. Default: true */
11
+ includeBlogStream?: boolean;
12
+ /** Include the Blog Post document type. Default: true */
13
+ includeBlogPost?: boolean;
14
+ /** Include the Blog Block object type (for use on pages). Default: true */
15
+ includeBlogBlock?: boolean;
16
+ includeFeatureImage?: boolean;
17
+ includeSummary?: boolean;
18
+ includeHashTags?: boolean;
19
+ includeAuthorNames?: boolean;
20
+ /** Enable a modular blocks field on Blog Posts. Default: false */
21
+ enablePostBlocks?: boolean;
22
+ /**
23
+ * Extra block type names to add to the Blog Post blocks array.
24
+ * These types must already be registered in your Sanity schema (via sanityCore).
25
+ * Only used when enablePostBlocks is true.
26
+ */
27
+ blogPostBlockTypeNames?: string[];
28
+ streamTitleFieldName?: string;
29
+ streamDescriptionFieldName?: string;
30
+ streamTagsFieldName?: string;
31
+ postTitleFieldName?: string;
32
+ postSlugFieldName?: string;
33
+ postStreamFieldName?: string;
34
+ postPublishDateFieldName?: string;
35
+ postAuthorNamesFieldName?: string;
36
+ postSummaryFieldName?: string;
37
+ postFeatureImageFieldName?: string;
38
+ postTagsFieldName?: string;
39
+ postHashTagsFieldName?: string;
40
+ postBlocksFieldName?: string;
41
+ blockTitleFieldName?: string;
42
+ blockHtmlFieldName?: string;
43
+ blockStreamFieldName?: string;
44
+ blockDisplayTagsFieldName?: string;
45
+ blockPostsPerPageFieldName?: string;
46
+ blockFeaturedBlogFieldName?: string;
47
+ defaultPostsPerPage?: number;
48
+ maxPostsPerPage?: number;
49
+ additionalStreamFields?: FieldDefinition[];
50
+ additionalPostFields?: FieldDefinition[];
51
+ additionalTagFields?: FieldDefinition[];
52
+ additionalBlockFields?: FieldDefinition[];
53
+ };
54
+ //# sourceMappingURL=options.d.ts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M,CAAA;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAE5B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,0BAA0B,CAAC,EAAE,MAAM,CAAA;IACnC,0BAA0B,CAAC,EAAE,MAAM,CAAA;IAEnC,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAA;IAExB,sBAAsB,CAAC,EAAE,eAAe,EAAE,CAAA;IAC1C,oBAAoB,CAAC,EAAE,eAAe,EAAE,CAAA;IACxC,mBAAmB,CAAC,EAAE,eAAe,EAAE,CAAA;IACvC,qBAAqB,CAAC,EAAE,eAAe,EAAE,CAAA;CAC1C,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/core/types/options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ export { sanityBlog } from './plugin.js';
2
+ export { createBlogTagType, blogTag, blogTagRegistration } from './schema/documents/blogTag.js';
3
+ export { createBlogStreamType, blogStream, blogStreamRegistration } from './schema/documents/blogStream.js';
4
+ export { createBlogPostType, blogPost, blogPostRegistration } from './schema/documents/blogPost.js';
5
+ export { createBlogBlock, blogBlock, blogBlockRegistration } from './schema/blocks/blogBlock.js';
6
+ export { createBlogStructureItems } from './structure/blogStructure.js';
7
+ export type { SanityBlogOptions } from './core/types/options.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAC,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;AAC7F,OAAO,EAAC,oBAAoB,EAAE,UAAU,EAAE,sBAAsB,EAAC,MAAM,kCAAkC,CAAA;AACzG,OAAO,EAAC,kBAAkB,EAAE,QAAQ,EAAE,oBAAoB,EAAC,MAAM,gCAAgC,CAAA;AAEjG,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAE9F,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAA;AAErE,YAAY,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ export { sanityBlog } from './plugin.js';
2
+ export { createBlogTagType, blogTag, blogTagRegistration } from './schema/documents/blogTag.js';
3
+ export { createBlogStreamType, blogStream, blogStreamRegistration } from './schema/documents/blogStream.js';
4
+ export { createBlogPostType, blogPost, blogPostRegistration } from './schema/documents/blogPost.js';
5
+ export { createBlogBlock, blogBlock, blogBlockRegistration } from './schema/blocks/blogBlock.js';
6
+ export { createBlogStructureItems } from './structure/blogStructure.js';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAA;AAEtC,OAAO,EAAC,iBAAiB,EAAE,OAAO,EAAE,mBAAmB,EAAC,MAAM,+BAA+B,CAAA;AAC7F,OAAO,EAAC,oBAAoB,EAAE,UAAU,EAAE,sBAAsB,EAAC,MAAM,kCAAkC,CAAA;AACzG,OAAO,EAAC,kBAAkB,EAAE,QAAQ,EAAE,oBAAoB,EAAC,MAAM,gCAAgC,CAAA;AAEjG,OAAO,EAAC,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAC,MAAM,8BAA8B,CAAA;AAE9F,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAA"}
@@ -0,0 +1,28 @@
1
+ import type { SanityBlogOptions } from './core/types/options.js';
2
+ /**
3
+ * Sanity Blog plugin.
4
+ *
5
+ * Registers the BlogTag, BlogStream, and BlogPost document types.
6
+ *
7
+ * BlogBlock is intentionally excluded from this plugin by default because
8
+ * sanityCore registers block object types when they are added to its `blocks`
9
+ * array — registering the type here too would cause a duplicate-type error.
10
+ *
11
+ * Typical usage:
12
+ *
13
+ * const blogOptions: SanityBlogOptions = { ... }
14
+ *
15
+ * plugins: [
16
+ * sanityBlog(blogOptions),
17
+ * sanityCore({
18
+ * blocks: [
19
+ * {name: 'blogBlock', type: createBlogBlock(blogOptions)},
20
+ * ],
21
+ * }),
22
+ * ]
23
+ *
24
+ * Only set `includeBlogBlock: true` if you are NOT adding it to sanityCore's
25
+ * blocks array (e.g. a standalone schema without sanityCore).
26
+ */
27
+ export declare const sanityBlog: import("sanity").Plugin<void | SanityBlogOptions>;
28
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,yBAAyB,CAAA;AAM9D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,UAAU,mDAmBrB,CAAA"}
package/dist/plugin.js ADDED
@@ -0,0 +1,49 @@
1
+ import { definePlugin } from 'sanity';
2
+ import { createBlogTagType } from './schema/documents/blogTag.js';
3
+ import { createBlogStreamType } from './schema/documents/blogStream.js';
4
+ import { createBlogPostType } from './schema/documents/blogPost.js';
5
+ import { createBlogBlock } from './schema/blocks/blogBlock.js';
6
+ /**
7
+ * Sanity Blog plugin.
8
+ *
9
+ * Registers the BlogTag, BlogStream, and BlogPost document types.
10
+ *
11
+ * BlogBlock is intentionally excluded from this plugin by default because
12
+ * sanityCore registers block object types when they are added to its `blocks`
13
+ * array — registering the type here too would cause a duplicate-type error.
14
+ *
15
+ * Typical usage:
16
+ *
17
+ * const blogOptions: SanityBlogOptions = { ... }
18
+ *
19
+ * plugins: [
20
+ * sanityBlog(blogOptions),
21
+ * sanityCore({
22
+ * blocks: [
23
+ * {name: 'blogBlock', type: createBlogBlock(blogOptions)},
24
+ * ],
25
+ * }),
26
+ * ]
27
+ *
28
+ * Only set `includeBlogBlock: true` if you are NOT adding it to sanityCore's
29
+ * blocks array (e.g. a standalone schema without sanityCore).
30
+ */
31
+ export const sanityBlog = definePlugin((config = {}) => {
32
+ const options = config ?? {};
33
+ const includeBlogTag = options.includeBlogTag ?? true;
34
+ const includeBlogStream = options.includeBlogStream ?? true;
35
+ const includeBlogPost = options.includeBlogPost ?? true;
36
+ const includeBlogBlock = options.includeBlogBlock ?? false;
37
+ return {
38
+ name: '@hello-better/sanity-blog',
39
+ schema: {
40
+ types: [
41
+ ...(includeBlogTag ? [createBlogTagType(options)] : []),
42
+ ...(includeBlogStream ? [createBlogStreamType(options)] : []),
43
+ ...(includeBlogPost ? [createBlogPostType(options)] : []),
44
+ ...(includeBlogBlock ? [createBlogBlock(options)] : []),
45
+ ],
46
+ },
47
+ };
48
+ });
49
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAA;AAEnC,OAAO,EAAC,iBAAiB,EAAC,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAC,oBAAoB,EAAC,MAAM,kCAAkC,CAAA;AACrE,OAAO,EAAC,kBAAkB,EAAC,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAC,eAAe,EAAC,MAAM,8BAA8B,CAAA;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAA2B,CAAC,MAAM,GAAG,EAAE,EAAE,EAAE;IAC/E,MAAM,OAAO,GAAG,MAAM,IAAI,EAAE,CAAA;IAE5B,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,IAAI,IAAI,CAAA;IACrD,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,IAAI,IAAI,CAAA;IAC3D,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,IAAI,CAAA;IACvD,MAAM,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,KAAK,CAAA;IAE1D,OAAO;QACL,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE;YACN,KAAK,EAAE;gBACL,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvD,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7D,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBACzD,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACxD;SACF;KACF,CAAA;AACH,CAAC,CAAC,CAAA"}
@@ -0,0 +1,33 @@
1
+ import type { SanityBlogOptions } from '../../core/types/options.js';
2
+ export declare const createBlogBlock: (options?: SanityBlogOptions) => {
3
+ type: "object";
4
+ name: string;
5
+ } & Omit<import("sanity").ObjectDefinition, "preview"> & {
6
+ preview?: import("sanity").PreviewConfig<{
7
+ title: string;
8
+ streamTitle: string;
9
+ }, Record<"title" | "streamTitle", any>> | undefined;
10
+ };
11
+ export declare const blogBlock: {
12
+ type: "object";
13
+ name: string;
14
+ } & Omit<import("sanity").ObjectDefinition, "preview"> & {
15
+ preview?: import("sanity").PreviewConfig<{
16
+ title: string;
17
+ streamTitle: string;
18
+ }, Record<"title" | "streamTitle", any>> | undefined;
19
+ };
20
+ export declare const blogBlockRegistration: {
21
+ name: string;
22
+ title: string;
23
+ type: {
24
+ type: "object";
25
+ name: string;
26
+ } & Omit<import("sanity").ObjectDefinition, "preview"> & {
27
+ preview?: import("sanity").PreviewConfig<{
28
+ title: string;
29
+ streamTitle: string;
30
+ }, Record<"title" | "streamTitle", any>> | undefined;
31
+ };
32
+ };
33
+ //# sourceMappingURL=blogBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogBlock.d.ts","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAUlE,eAAO,MAAM,eAAe,GAAI,UAAS,iBAAsB;;;;;;;;CAoH9D,CAAA;AAED,eAAO,MAAM,SAAS;;;;;;;;CAAoB,CAAA;AAE1C,eAAO,MAAM,qBAAqB;;;;;;;;;;;;CAIjC,CAAA"}
@@ -0,0 +1,123 @@
1
+ import { defineField, defineType } from 'sanity';
2
+ import { DocumentTextIcon, CogIcon } from '@sanity/icons';
3
+ import { hiddenAllFieldsGroup } from '@hello-better/sanity-core';
4
+ import { createRichTextField } from '@hello-better/sanity-content-block';
5
+ const defaultSpacingOptions = [
6
+ { title: 'None', value: 'none' },
7
+ { title: 'Small', value: 'sm' },
8
+ { title: 'Medium', value: 'md' },
9
+ { title: 'Large', value: 'lg' },
10
+ { title: 'Extra Large', value: 'xl' },
11
+ ];
12
+ export const createBlogBlock = (options = {}) => {
13
+ const blockTypeName = options.blogBlockTypeName ?? 'blogBlock';
14
+ const streamTypeName = options.blogStreamTypeName ?? 'blogStream';
15
+ const postTypeName = options.blogPostTypeName ?? 'blogPost';
16
+ const titleFieldName = options.blockTitleFieldName ?? 'title';
17
+ const htmlFieldName = options.blockHtmlFieldName ?? 'html';
18
+ const streamFieldName = options.blockStreamFieldName ?? 'stream';
19
+ const displayTagsFieldName = options.blockDisplayTagsFieldName ?? 'displayTags';
20
+ const postsPerPageFieldName = options.blockPostsPerPageFieldName ?? 'postsPerPage';
21
+ const featuredBlogFieldName = options.blockFeaturedBlogFieldName ?? 'featuredBlog';
22
+ const defaultPostsPerPage = options.defaultPostsPerPage ?? 9;
23
+ const maxPostsPerPage = options.maxPostsPerPage ?? 50;
24
+ const spacingOptions = options.spacingOptions ?? defaultSpacingOptions;
25
+ return defineType({
26
+ name: blockTypeName,
27
+ title: 'Blog Block',
28
+ type: 'object',
29
+ groups: [
30
+ { name: 'content', title: 'Content', icon: DocumentTextIcon, default: true },
31
+ { name: 'settings', title: 'Settings', icon: CogIcon },
32
+ hiddenAllFieldsGroup,
33
+ ],
34
+ fields: [
35
+ defineField({
36
+ name: titleFieldName,
37
+ title: 'Title',
38
+ type: 'string',
39
+ group: 'content',
40
+ }),
41
+ createRichTextField({
42
+ name: htmlFieldName,
43
+ title: 'HTML',
44
+ group: 'content',
45
+ }),
46
+ defineField({
47
+ name: streamFieldName,
48
+ title: 'Select Stream',
49
+ type: 'reference',
50
+ group: 'content',
51
+ to: [{ type: streamTypeName }],
52
+ validation: (Rule) => Rule.required(),
53
+ description: 'Blog posts from this stream will be displayed.',
54
+ }),
55
+ defineField({
56
+ name: displayTagsFieldName,
57
+ title: 'Display Tags?',
58
+ type: 'boolean',
59
+ group: 'content',
60
+ initialValue: false,
61
+ description: 'Show tag filters above the post listing.',
62
+ }),
63
+ defineField({
64
+ name: postsPerPageFieldName,
65
+ title: 'Posts Per Page',
66
+ type: 'number',
67
+ group: 'content',
68
+ initialValue: defaultPostsPerPage,
69
+ validation: (Rule) => Rule.min(1).max(maxPostsPerPage),
70
+ }),
71
+ defineField({
72
+ name: featuredBlogFieldName,
73
+ title: 'Featured Blog',
74
+ type: 'reference',
75
+ group: 'content',
76
+ to: [{ type: postTypeName }],
77
+ description: 'Optionally pin a specific post as the featured entry.',
78
+ }),
79
+ defineField({
80
+ name: 'paddingTop',
81
+ title: 'Padding Top',
82
+ type: 'string',
83
+ group: 'settings',
84
+ initialValue: 'md',
85
+ options: { layout: 'dropdown', list: spacingOptions },
86
+ }),
87
+ defineField({
88
+ name: 'paddingBottom',
89
+ title: 'Padding Bottom',
90
+ type: 'string',
91
+ group: 'settings',
92
+ initialValue: 'md',
93
+ options: { layout: 'dropdown', list: spacingOptions },
94
+ }),
95
+ defineField({
96
+ name: 'marginTop',
97
+ title: 'Margin Top',
98
+ type: 'string',
99
+ group: 'settings',
100
+ initialValue: 'none',
101
+ options: { layout: 'dropdown', list: spacingOptions },
102
+ }),
103
+ ...(options.additionalBlockFields ?? []),
104
+ ],
105
+ preview: {
106
+ select: {
107
+ title: titleFieldName,
108
+ streamTitle: `${streamFieldName}.title`,
109
+ },
110
+ prepare: ({ title, streamTitle }) => ({
111
+ title: title || 'Blog Block',
112
+ subtitle: streamTitle ? `Stream: ${streamTitle}` : 'Blog Block',
113
+ }),
114
+ },
115
+ });
116
+ };
117
+ export const blogBlock = createBlogBlock();
118
+ export const blogBlockRegistration = {
119
+ name: 'blogBlock',
120
+ title: 'Blog Block',
121
+ type: blogBlock,
122
+ };
123
+ //# sourceMappingURL=blogBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogBlock.js","sourceRoot":"","sources":["../../../src/schema/blocks/blogBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AAC9C,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAA;AACvD,OAAO,EAAC,oBAAoB,EAAC,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAA;AAGtE,MAAM,qBAAqB,GAAG;IAC5B,EAAC,KA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W,CAAC,CAAC,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC,CAAC,YAAY;aAChE,CAAC;SACH;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,WAAW;IACjB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,SAAS;CAChB,CAAA"}
@@ -0,0 +1,36 @@
1
+ import type { SanityBlogOptions } from '../../core/types/options.js';
2
+ export declare const createBlogPostType: (options?: SanityBlogOptions) => {
3
+ type: "document";
4
+ name: string;
5
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
6
+ preview?: import("sanity").PreviewConfig<{
7
+ title: string;
8
+ media: string;
9
+ date: string;
10
+ }, Record<"date" | "title" | "media", any>> | undefined;
11
+ };
12
+ export declare const blogPost: {
13
+ type: "document";
14
+ name: string;
15
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
16
+ preview?: import("sanity").PreviewConfig<{
17
+ title: string;
18
+ media: string;
19
+ date: string;
20
+ }, Record<"date" | "title" | "media", any>> | undefined;
21
+ };
22
+ export declare const blogPostRegistration: {
23
+ name: string;
24
+ title: string;
25
+ type: {
26
+ type: "document";
27
+ name: string;
28
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
29
+ preview?: import("sanity").PreviewConfig<{
30
+ title: string;
31
+ media: string;
32
+ date: string;
33
+ }, Record<"date" | "title" | "media", any>> | undefined;
34
+ };
35
+ };
36
+ //# sourceMappingURL=blogPost.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogPost.d.ts","sourceRoot":"","sources":["../../../src/schema/documents/blogPost.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAElE,eAAO,MAAM,kBAAkB,GAAI,UAAS,iBAAsB;;;;;;;;;CA2KjE,CAAA;AAED,eAAO,MAAM,QAAQ;;;;;;;;;CAAuB,CAAA;AAE5C,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;CAIhC,CAAA"}
@@ -0,0 +1,171 @@
1
+ import { defineArrayMember, defineField, defineType } from 'sanity';
2
+ import { DocumentTextIcon, TagIcon } from '@sanity/icons';
3
+ import { hiddenAllFieldsGroup } from '@hello-better/sanity-core';
4
+ import { createRichTextField, richTextOf } from '@hello-better/sanity-content-block';
5
+ export const createBlogPostType = (options = {}) => {
6
+ const typeName = options.blogPostTypeName ?? 'blogPost';
7
+ const streamTypeName = options.blogStreamTypeName ?? 'blogStream';
8
+ const tagTypeName = options.blogTagTypeName ?? 'blogTag';
9
+ const includeFeatureImage = options.includeFeatureImage ?? true;
10
+ const includeSummary = options.includeSummary ?? true;
11
+ const includeHashTags = options.includeHashTags ?? true;
12
+ const includeAuthorNames = options.includeAuthorNames ?? true;
13
+ const enablePostBlocks = options.enablePostBlocks ?? false;
14
+ const blogPostBlockTypeNames = options.blogPostBlockTypeNames ?? [];
15
+ const titleFieldName = options.postTitleFieldName ?? 'title';
16
+ const slugFieldName = options.postSlugFieldName ?? 'slug';
17
+ const streamFieldName = options.postStreamFieldName ?? 'stream';
18
+ const publishDateFieldName = options.postPublishDateFieldName ?? 'publishDate';
19
+ const authorNamesFieldName = options.postAuthorNamesFieldName ?? 'authorNames';
20
+ const summaryFieldName = options.postSummaryFieldName ?? 'summary';
21
+ const featureImageFieldName = options.postFeatureImageFieldName ?? 'featureImage';
22
+ const tagsFieldName = options.postTagsFieldName ?? 'tags';
23
+ const hashTagsFieldName = options.postHashTagsFieldName ?? 'hashTags';
24
+ const blocksFieldName = options.postBlocksFieldName ?? 'blocks';
25
+ return defineType({
26
+ name: typeName,
27
+ title: 'Blog Post',
28
+ type: 'document',
29
+ groups: [
30
+ { name: 'content', title: 'Content', icon: DocumentTextIcon, default: true },
31
+ { name: 'meta', title: 'Meta & Tags', icon: TagIcon },
32
+ hiddenAllFieldsGroup,
33
+ ],
34
+ fields: [
35
+ defineField({
36
+ name: titleFieldName,
37
+ title: 'Title',
38
+ type: 'string',
39
+ group: 'content',
40
+ validation: (Rule) => Rule.required(),
41
+ }),
42
+ defineField({
43
+ name: slugFieldName,
44
+ title: 'Slug',
45
+ type: 'slug',
46
+ group: 'meta',
47
+ options: { source: titleFieldName },
48
+ validation: (Rule) => Rule.required(),
49
+ }),
50
+ defineField({
51
+ name: streamFieldName,
52
+ title: 'Blog Stream',
53
+ type: 'reference',
54
+ group: 'meta',
55
+ to: [{ type: streamTypeName }],
56
+ validation: (Rule) => Rule.required(),
57
+ description: 'Assign this post to a stream. Tags will be filtered to those defined on the stream.',
58
+ }),
59
+ defineField({
60
+ name: publishDateFieldName,
61
+ title: 'Publish Date',
62
+ type: 'datetime',
63
+ group: 'meta',
64
+ initialValue: () => new Date().toISOString(),
65
+ }),
66
+ ...(includeAuthorNames
67
+ ? [
68
+ defineField({
69
+ name: authorNamesFieldName,
70
+ title: 'Author Names',
71
+ type: 'array',
72
+ group: 'meta',
73
+ of: [defineArrayMember({ type: 'string' })],
74
+ description: 'Add one or more author names.',
75
+ }),
76
+ ]
77
+ : []),
78
+ ...(includeSummary
79
+ ? [
80
+ defineField({
81
+ name: summaryFieldName,
82
+ title: 'Summary',
83
+ type: 'text',
84
+ rows: 3,
85
+ group: 'content',
86
+ }),
87
+ ]
88
+ : []),
89
+ ...(includeFeatureImage
90
+ ? [
91
+ defineField({
92
+ name: featureImageFieldName,
93
+ title: 'Feature Image',
94
+ type: 'image',
95
+ group: 'content',
96
+ options: { hotspot: true },
97
+ }),
98
+ ]
99
+ : []),
100
+ defineField({
101
+ name: tagsFieldName,
102
+ title: 'Tags',
103
+ type: 'array',
104
+ group: 'meta',
105
+ description: 'Select tags from the assigned stream.',
106
+ of: [
107
+ defineArrayMember({
108
+ type: 'reference',
109
+ to: [{ type: tagTypeName }],
110
+ options: {
111
+ // Filter tag choices to only those defined on the selected stream.
112
+ filter: ({ document }) => {
113
+ const streamRef = document?.[streamFieldName];
114
+ if (!streamRef?._ref)
115
+ return {};
116
+ return {
117
+ filter: '_id in *[_type == $streamType && _id == $streamId][0].tags[]._ref',
118
+ params: { streamType: streamTypeName, streamId: streamRef._ref },
119
+ };
120
+ },
121
+ },
122
+ }),
123
+ ],
124
+ }),
125
+ ...(includeHashTags
126
+ ? [
127
+ defineField({
128
+ name: hashTagsFieldName,
129
+ title: 'Hash Tags',
130
+ type: 'string',
131
+ group: 'meta',
132
+ description: 'Space-separated hashtags. Example: design webdev ux',
133
+ }),
134
+ ]
135
+ : []),
136
+ createRichTextField({
137
+ name: blocksFieldName,
138
+ title: 'Content',
139
+ group: 'content',
140
+ // When enablePostBlocks is true, append extra registered block types after
141
+ // the standard rich-text members (headings, links, images, etc.).
142
+ of: enablePostBlocks
143
+ ? [
144
+ ...richTextOf,
145
+ ...blogPostBlockTypeNames.map((name) => defineArrayMember({ type: name })),
146
+ ]
147
+ : undefined,
148
+ }),
149
+ ...(options.additionalPostFields ?? []),
150
+ ],
151
+ preview: {
152
+ select: {
153
+ title: titleFieldName,
154
+ media: featureImageFieldName,
155
+ date: publishDateFieldName,
156
+ },
157
+ prepare: ({ title, media, date }) => ({
158
+ title: title || 'Untitled Post',
159
+ subtitle: date ? new Date(date).toLocaleDateString() : 'Blog Post',
160
+ media,
161
+ }),
162
+ },
163
+ });
164
+ };
165
+ export const blogPost = createBlogPostType();
166
+ export const blogPostRegistration = {
167
+ name: 'blogPost',
168
+ title: 'Blog Posts',
169
+ type: blogPost,
170
+ };
171
+ //# sourceMappingURL=blogPost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogPost.js","sourceRoot":"","sources":["../../../src/schema/documents/blogPost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AACjE,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAA;AACvD,OAAO,EAAC,oBAA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AE,qBAAqB;gBAC5B,IAAI,EAAE,oBAAoB;aAC3B;YACD,OAAO,EAAE,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,EAAE,EAAE,CAAC,CAAC;gBAClC,KAAK,EAAE,KAAK,IAAI,eAAe;gBAC/B,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAc,CAAC,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,WAAW;gBAC5E,KAAK;aACN,CAAC;SACH;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,EAAE,CAAA;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,YAAY;IACnB,IAAI,EAAE,QAAQ;CACf,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { SanityBlogOptions } from '../../core/types/options.js';
2
+ export declare const createBlogStreamType: (options?: SanityBlogOptions) => {
3
+ type: "document";
4
+ name: string;
5
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
6
+ preview?: import("sanity").PreviewConfig<{
7
+ title: string;
8
+ }, Record<"title", any>> | undefined;
9
+ };
10
+ export declare const blogStream: {
11
+ type: "document";
12
+ name: string;
13
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
14
+ preview?: import("sanity").PreviewConfig<{
15
+ title: string;
16
+ }, Record<"title", any>> | undefined;
17
+ };
18
+ export declare const blogStreamRegistration: {
19
+ name: string;
20
+ title: string;
21
+ type: {
22
+ type: "document";
23
+ name: string;
24
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
25
+ preview?: import("sanity").PreviewConfig<{
26
+ title: string;
27
+ }, Record<"title", any>> | undefined;
28
+ };
29
+ };
30
+ //# sourceMappingURL=blogStream.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogStream.d.ts","sourceRoot":"","sources":["../../../src/schema/documents/blogStream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAElE,eAAO,MAAM,oBAAoB,GAAI,UAAS,iBAAsB;;;;;;;CA+CnE,CAAA;AAED,eAAO,MAAM,UAAU;;;;;;;CAAyB,CAAA;AAEhD,eAAO,MAAM,sBAAsB;;;;;;;;;;;CAIlC,CAAA"}
@@ -0,0 +1,54 @@
1
+ import { defineArrayMember, defineField, defineType } from 'sanity';
2
+ export const createBlogStreamType = (options = {}) => {
3
+ const typeName = options.blogStreamTypeName ?? 'blogStream';
4
+ const tagTypeName = options.blogTagTypeName ?? 'blogTag';
5
+ const titleFieldName = options.streamTitleFieldName ?? 'title';
6
+ const descriptionFieldName = options.streamDescriptionFieldName ?? 'description';
7
+ const tagsFieldName = options.streamTagsFieldName ?? 'tags';
8
+ return defineType({
9
+ name: typeName,
10
+ title: 'Blog Stream',
11
+ type: 'document',
12
+ fields: [
13
+ defineField({
14
+ name: titleFieldName,
15
+ title: 'Title',
16
+ type: 'string',
17
+ validation: (Rule) => Rule.required(),
18
+ }),
19
+ defineField({
20
+ name: descriptionFieldName,
21
+ title: 'Description',
22
+ type: 'text',
23
+ rows: 3,
24
+ }),
25
+ defineField({
26
+ name: tagsFieldName,
27
+ title: 'Tags',
28
+ type: 'array',
29
+ description: 'Define the tags available for posts in this stream.',
30
+ of: [
31
+ defineArrayMember({
32
+ type: 'reference',
33
+ to: [{ type: tagTypeName }],
34
+ }),
35
+ ],
36
+ }),
37
+ ...(options.additionalStreamFields ?? []),
38
+ ],
39
+ preview: {
40
+ select: { title: titleFieldName },
41
+ prepare: ({ title }) => ({
42
+ title: title || 'Untitled Stream',
43
+ subtitle: 'Blog Stream',
44
+ }),
45
+ },
46
+ });
47
+ };
48
+ export const blogStream = createBlogStreamType();
49
+ export const blogStreamRegistration = {
50
+ name: 'blogStream',
51
+ title: 'Blog Streams',
52
+ type: blogStream,
53
+ };
54
+ //# sourceMappingURL=blogSt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qBAC1B,CAAC;iBACH;aACF,CAAC;YACF,GAAG,CAAC,OAAO,CAAC,sBAAsB,IAAI,EAAE,CAAC;SAC1C;QACD,OAAO,EAAE;YACP,MAAM,EAAE,EAAC,KAAK,EAAE,cAAc,EAAC;YAC/B,OAAO,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,KAAK,EAAE,KAAK,IAAI,iBAAiB;gBACjC,QAAQ,EAAE,aAAa;aACxB,CAAC;SACH;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,EAAE,CAAA;AAEhD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,YAAY;IAClB,KAAK,EAAE,cAAc;IACrB,IAAI,EAAE,UAAU;CACjB,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { SanityBlogOptions } from '../../core/types/options.js';
2
+ export declare const createBlogTagType: (options?: SanityBlogOptions) => {
3
+ type: "document";
4
+ name: string;
5
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
6
+ preview?: import("sanity").PreviewConfig<{
7
+ title: string;
8
+ }, Record<"title", any>> | undefined;
9
+ };
10
+ export declare const blogTag: {
11
+ type: "document";
12
+ name: string;
13
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
14
+ preview?: import("sanity").PreviewConfig<{
15
+ title: string;
16
+ }, Record<"title", any>> | undefined;
17
+ };
18
+ export declare const blogTagRegistration: {
19
+ name: string;
20
+ title: string;
21
+ type: {
22
+ type: "document";
23
+ name: string;
24
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
25
+ preview?: import("sanity").PreviewConfig<{
26
+ title: string;
27
+ }, Record<"title", any>> | undefined;
28
+ };
29
+ };
30
+ //# sourceMappingURL=blogTag.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogTag.d.ts","sourceRoot":"","sources":["../../../src/schema/documents/blogTag.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAA;AAElE,eAAO,MAAM,iBAAiB,GAAI,UAAS,iBAAsB;;;;;;;CA+BhE,CAAA;AAED,eAAO,MAAM,OAAO;;;;;;;CAAsB,CAAA;AAE1C,eAAO,MAAM,mBAAmB;;;;;;;;;;;CAI/B,CAAA"}
@@ -0,0 +1,39 @@
1
+ import { defineField, defineType } from 'sanity';
2
+ export const createBlogTagType = (options = {}) => {
3
+ const typeName = options.blogTagTypeName ?? 'blogTag';
4
+ return defineType({
5
+ name: typeName,
6
+ title: 'Blog Tag',
7
+ type: 'document',
8
+ fields: [
9
+ defineField({
10
+ name: 'title',
11
+ title: 'Title',
12
+ type: 'string',
13
+ validation: (Rule) => Rule.required(),
14
+ }),
15
+ defineField({
16
+ name: 'slug',
17
+ title: 'Slug',
18
+ type: 'slug',
19
+ options: { source: 'title' },
20
+ validation: (Rule) => Rule.required(),
21
+ }),
22
+ ...(options.additionalTagFields ?? []),
23
+ ],
24
+ preview: {
25
+ select: { title: 'title' },
26
+ prepare: ({ title }) => ({
27
+ title: title || 'Untitled Tag',
28
+ subtitle: 'Blog Tag',
29
+ }),
30
+ },
31
+ });
32
+ };
33
+ export const blogTag = createBlogTagType();
34
+ export const blogTagRegistration = {
35
+ name: 'blogTag',
36
+ title: 'Blog Tags',
37
+ type: blogTag,
38
+ };
39
+ //# sourceMappingURL=blogTag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogTag.js","sourceRoot":"","sources":["../../../src/schema/documents/blogTag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAA;AAG9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAA6B,EAAE,EAAE,EAAE;IACnE,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,IAAI,SAAS,CAAA;IAErD,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,UAAU;QACjB,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE;YACN,WAAW,CAAC;gBACV,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,OAAO;gBACd,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;aACtC,CAAC;YACF,WAAW,CAAC;gBACV,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,MAAM;gBACb,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAC,MAAM,EAAE,OAAO,EAAC;gBAC1B,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;aACtC,CAAC;YACF,GAAG,CAAC,OAAO,CAAC,mBAAmB,IAAI,EAAE,CAAC;SACvC;QACD,OAAO,EAAE;YACP,MAAM,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC;YACxB,OAAO,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,CAAC;gBACrB,KAAK,EAAE,KAAK,IAAI,cAAc;gBAC9B,QAAQ,EAAE,UAAU;aACrB,CAAC;SACH;KACF,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAA;AAE1C,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,SAAS;IACf,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,OAAO;CACd,CAAA"}
@@ -0,0 +1,14 @@
1
+ import type { ListItemBuilder, StructureBuilder } from 'sanity/structure';
2
+ import type { SanityBlogOptions } from '../core/types/options.js';
3
+ /**
4
+ * Returns a single "Blog" list item for the Sanity Studio sidebar with
5
+ * nested sections for Streams, Posts, and Tags.
6
+ *
7
+ * Usage — pass to createCoreStructure via additionalStructureItems:
8
+ *
9
+ * createCoreStructure({
10
+ * additionalStructureItems: (S) => createBlogStructureItems(blogOptions, S),
11
+ * })
12
+ */
13
+ export declare const createBlogStructureItems: (options: SanityBlogOptions | undefined, S: StructureBuilder) => ListItemBuilder[];
14
+ //# sourceMappingURL=blogStructure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogStructure.d.ts","sourceRoot":"","sources":["../../src/structure/blogStructure.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,kBAAkB,CAAA;AACvE,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAA;AAE/D;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,GACnC,SAAS,iBAAiB,YAAK,EAC/B,GAAG,gBAAgB,KAClB,eAAe,EAiCjB,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { BookIcon, TagIcon, ComposeIcon } from '@sanity/icons';
2
+ /**
3
+ * Returns a single "Blog" list item for the Sanity Studio sidebar with
4
+ * nested sections for Streams, Posts, and Tags.
5
+ *
6
+ * Usage — pass to createCoreStructure via additionalStructureItems:
7
+ *
8
+ * createCoreStructure({
9
+ * additionalStructureItems: (S) => createBlogStructureItems(blogOptions, S),
10
+ * })
11
+ */
12
+ export const createBlogStructureItems = (options = {}, S) => {
13
+ const streamTypeName = options.blogStreamTypeName ?? 'blogStream';
14
+ const postTypeName = options.blogPostTypeName ?? 'blogPost';
15
+ const tagTypeName = options.blogTagTypeName ?? 'blogTag';
16
+ return [
17
+ S.listItem()
18
+ .title('Blogs')
19
+ .icon(BookIcon)
20
+ .child(S.list()
21
+ .title('Blogs')
22
+ .items([
23
+ S.listItem()
24
+ .title('Streams')
25
+ .icon(ComposeIcon)
26
+ .schemaType(streamTypeName)
27
+ .child(S.documentTypeList(streamTypeName).title('Blog Streams')),
28
+ S.listItem()
29
+ .title('Posts')
30
+ .icon(BookIcon)
31
+ .schemaType(postTypeName)
32
+ .child(S.documentTypeList(postTypeName).title('Blog Posts')),
33
+ S.listItem()
34
+ .title('Tags')
35
+ .icon(TagIcon)
36
+ .schemaType(tagTypeName)
37
+ .child(S.documentTypeList(tagTypeName).title('Blog Tags')),
38
+ ])),
39
+ ];
40
+ };
41
+ //# sourceMappingURL=blogStructure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blogStructure.js","sourceRoot":"","sources":["../../src/structure/blogStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,eAAe,CAAA;AAI5D;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,UAA6B,EAAE,EAC/B,CAAmB,EACA,EAAE;IACrB,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,IAAI,YAAY,CAAA;IACjE,MAAM,YAAY,GAAG,OAAO,CAAC,gBAAgB,IAAI,UAAU,CAAA;IAC3D,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,IAAI,SAAS,CAAA;IAExD,OAAO;QACL,CAAC,CAAC,QAAQ,EAAE;aACT,KAAK,CAAC,OAAO,CAAC;aACd,IAAI,CAAC,QAAQ,CAAC;aACd,KAAK,CACJ,CAAC,CAAC,IAAI,EAAE;aACL,KAAK,CAAC,OAAO,CAAC;aACd,KAAK,CAAC;YACL,CAAC,CAAC,QAAQ,EAAE;iBACT,KAAK,CAAC,SAAS,CAAC;iBAChB,IAAI,CAAC,WAAW,CAAC;iBACjB,UAAU,CAAC,cAAc,CAAC;iBAC1B,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;YAElE,CAAC,CAAC,QAAQ,EAAE;iBACT,KAAK,CAAC,OAAO,CAAC;iBACd,IAAI,CAAC,QAAQ,CAAC;iBACd,UAAU,CAAC,YAAY,CAAC;iBACxB,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAE9D,CAAC,CAAC,QAAQ,EAAE;iBACT,KAAK,CAAC,MAAM,CAAC;iBACb,IAAI,CAAC,OAAO,CAAC;iBACb,UAAU,CAAC,WAAW,CAAC;iBACvB,KAAK,CAAC,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;SAC7D,CAAC,CACL;KACJ,CAAA;AACH,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@hello-better/sanity-blog",
3
+ "version": "0.1.0",
4
+ "description": "Sanity blog module with Blog Stream, Blog Post, Blog Tag documents and Blog Block — inspired by Silverstripe's blog module.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "clean": "rimraf dist",
21
+ "build": "yarn clean && tsc",
22
+ "prepublishOnly": "yarn build"
23
+ },
24
+ "peerDependencies": {
25
+ "@hello-better/sanity-core": "^0.1.1",
26
+ "@hello-better/sanity-content-block": "^0.1.3",
27
+ "sanity": ">=5.24.0",
28
+ "react": ">=18 <20",
29
+ "react-dom": ">=18 <20"
30
+ },
31
+ "devDependencies": {
32
+ "typescript": "^6.0.3",
33
+ "rimraf": "^6.0.1"
34
+ }
35
+ }
package/readme.md ADDED
@@ -0,0 +1,23 @@
1
+ How to use it in sanity.config.ts
2
+
3
+ import {sanityBlog, createBlogBlock, createBlogStructureItems} from '@hello-better/sanity-blog'
4
+ import type {SanityBlogOptions} from '@hello-better/sanity-blog'
5
+
6
+ const blogOptions: SanityBlogOptions = {
7
+ // All optional — defaults work out of the box
8
+ blogStreamTypeName: 'blogStream',
9
+ defaultPostsPerPage: 9,
10
+ }
11
+
12
+ // 1. Add the plugin (registers document types + BlogBlock object type)
13
+ plugins: [
14
+ sanityBlog(blogOptions),
15
+ sanityCore({
16
+ // 2. Add BlogBlock to the page builder
17
+ blocks: [
18
+ {name: 'blogBlock', type: createBlogBlock(blogOptions)},
19
+ ],
20
+ // 3. Wire up the sidebar section
21
+ additionalStructureItems: (S) => createBlogStructureItems(blogOptions, S),
22
+ }),
23
+ ]