@studiocms/blog 0.1.0-beta.30 → 0.1.0-beta.31
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.
- package/dist/components/BaseHead.astro +1 -1
- package/dist/components/PostHeader.astro +1 -1
- package/dist/components/heroHelper.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/layouts/Layout.astro +1 -1
- package/dist/routes/[...slug].astro +2 -4
- package/dist/routes/blog/[...slug].astro +2 -4
- package/dist/routes/blog/index.astro +3 -3
- package/dist/routes/rss.xml.js +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/utils/remapFilter.d.ts +3 -3
- package/dist/utils/remapFilter.js +1 -1
- package/package.json +5 -5
|
@@ -19,4 +19,4 @@ export declare function trimInput(input: string | null | undefined): string | un
|
|
|
19
19
|
* @param Astro - The Astro global context, used to access site configuration.
|
|
20
20
|
* @returns The resolved hero image URL as a string.
|
|
21
21
|
*/
|
|
22
|
-
export declare function getHeroImage(hero: string | undefined, Astro: AstroGlobal): string;
|
|
22
|
+
export declare function getHeroImage(hero: string | null | undefined, Astro: AstroGlobal): string;
|
package/dist/index.js
CHANGED
|
@@ -81,13 +81,15 @@ function studioCMSBlogPlugin(options) {
|
|
|
81
81
|
studiocmsMinimumVersion: "0.1.0-beta.21",
|
|
82
82
|
requires: ["@studiocms/md"],
|
|
83
83
|
hooks: {
|
|
84
|
-
"studiocms:astro
|
|
84
|
+
"studiocms:astro-config": ({ addIntegrations }) => {
|
|
85
85
|
addIntegrations(internalBlogIntegration(resolvedOptions));
|
|
86
86
|
},
|
|
87
|
-
"studiocms:
|
|
87
|
+
"studiocms:frontend": ({ setFrontend }) => {
|
|
88
88
|
setFrontend({
|
|
89
89
|
frontendNavigationLinks: [{ label: title, href: route }]
|
|
90
90
|
});
|
|
91
|
+
},
|
|
92
|
+
"studiocms:rendering": ({ setRendering }) => {
|
|
91
93
|
setRendering({
|
|
92
94
|
pageTypes: [
|
|
93
95
|
{
|
|
@@ -98,6 +100,8 @@ function studioCMSBlogPlugin(options) {
|
|
|
98
100
|
}
|
|
99
101
|
]
|
|
100
102
|
});
|
|
103
|
+
},
|
|
104
|
+
"studiocms:sitemap": ({ setSitemap }) => {
|
|
101
105
|
setSitemap({
|
|
102
106
|
triggerSitemap: sitemap,
|
|
103
107
|
sitemaps: [
|
|
@@ -18,7 +18,7 @@ type Props = {
|
|
|
18
18
|
title: string;
|
|
19
19
|
description: string;
|
|
20
20
|
lang?: string | undefined;
|
|
21
|
-
heroImage?: string | undefined;
|
|
21
|
+
heroImage?: string | null | undefined;
|
|
22
22
|
siteTitle?: string | undefined;
|
|
23
23
|
siteDescription?: string | undefined;
|
|
24
24
|
pageTitleDelimiter?: string | undefined;
|
|
@@ -9,14 +9,12 @@ if (!slug) {
|
|
|
9
9
|
slug = 'index';
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const page = await runSDK(SDKCoreJs.GET.page.bySlug(slug));
|
|
13
13
|
|
|
14
|
-
if (!
|
|
14
|
+
if (!page) {
|
|
15
15
|
return new Response(null, { status: 404 });
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
const page = fullPageData.data;
|
|
19
|
-
|
|
20
18
|
const { title, description, heroImage } = page;
|
|
21
19
|
---
|
|
22
20
|
|
|
@@ -14,15 +14,13 @@ if (!slug) {
|
|
|
14
14
|
|
|
15
15
|
// Fetch the blog post content
|
|
16
16
|
|
|
17
|
-
const
|
|
17
|
+
const post = await runSDK(SDKCoreJs.GET.page.bySlug(slug));
|
|
18
18
|
|
|
19
19
|
// If no content is found, redirect to 404
|
|
20
|
-
if (!
|
|
20
|
+
if (!post) {
|
|
21
21
|
return new Response(null, { status: 404 });
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
const post = fullPageData.data;
|
|
25
|
-
|
|
26
24
|
const { title, description, heroImage, publishedAt, updatedAt } = post;
|
|
27
25
|
---
|
|
28
26
|
|
|
@@ -15,9 +15,9 @@ const description: string = configDescription || 'Blog Index';
|
|
|
15
15
|
const showRSSFeed: boolean = blogConfig.enableRSS;
|
|
16
16
|
|
|
17
17
|
// Get all pages
|
|
18
|
-
const blogPageList = (await runSDK(SDKCoreJs.GET.pages()))
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const blogPageList = (await runSDK(SDKCoreJs.GET.pages())).filter(
|
|
19
|
+
({ package: pkg }) => pkg === '@studiocms/blog'
|
|
20
|
+
);
|
|
21
21
|
|
|
22
22
|
// Get the RSS feed URL
|
|
23
23
|
const rssPath = '/rss.xml';
|
package/dist/routes/rss.xml.js
CHANGED
|
@@ -13,7 +13,7 @@ const GET = withEffectAPI(
|
|
|
13
13
|
const description = config?.description ?? "Blog";
|
|
14
14
|
const site = _site ?? "https://example.com";
|
|
15
15
|
const posts = yield* sdk.GET.pages();
|
|
16
|
-
const sortedPosts = posts.
|
|
16
|
+
const sortedPosts = posts.filter(({ package: pkg }) => pkg === "@studiocms/blog").sort((a, b) => new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime());
|
|
17
17
|
const items = sortedPosts.map(
|
|
18
18
|
({ title: title2, description: description2, publishedAt, slug, categories: categoryData }) => {
|
|
19
19
|
const link = pathWithBase(getBlogRoute(slug));
|
package/dist/types.d.ts
CHANGED
|
@@ -28,11 +28,11 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
28
28
|
attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
|
|
29
29
|
content: z.ZodDefault<z.ZodString>;
|
|
30
30
|
}, "strip", z.ZodTypeAny, {
|
|
31
|
-
tag: "
|
|
31
|
+
tag: "style" | "title" | "base" | "link" | "meta" | "script" | "noscript" | "template";
|
|
32
32
|
attrs: Record<string, string | boolean | undefined>;
|
|
33
33
|
content: string;
|
|
34
34
|
}, {
|
|
35
|
-
tag: "
|
|
35
|
+
tag: "style" | "title" | "base" | "link" | "meta" | "script" | "noscript" | "template";
|
|
36
36
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
37
37
|
content?: string | undefined;
|
|
38
38
|
}>, "many">>;
|
|
@@ -80,7 +80,7 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
80
80
|
}, "strip", z.ZodTypeAny, {
|
|
81
81
|
htmlDefaultLanguage: string;
|
|
82
82
|
htmlDefaultHead: {
|
|
83
|
-
tag: "
|
|
83
|
+
tag: "style" | "title" | "base" | "link" | "meta" | "script" | "noscript" | "template";
|
|
84
84
|
attrs: Record<string, string | boolean | undefined>;
|
|
85
85
|
content: string;
|
|
86
86
|
}[];
|
|
@@ -95,7 +95,7 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
95
95
|
}, {
|
|
96
96
|
htmlDefaultLanguage?: string | undefined;
|
|
97
97
|
htmlDefaultHead?: {
|
|
98
|
-
tag: "
|
|
98
|
+
tag: "style" | "title" | "base" | "link" | "meta" | "script" | "noscript" | "template";
|
|
99
99
|
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
100
100
|
content?: string | undefined;
|
|
101
101
|
}[] | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { CombinedPageData } from 'studiocms:sdk/types';
|
|
1
2
|
import type { APIContext } from 'astro';
|
|
2
|
-
import type { PageDataCacheObject } from 'studiocms/sdk/types';
|
|
3
3
|
export declare function getBlogRoute(slug: string): string;
|
|
4
4
|
export type SiteMapTemplate = {
|
|
5
5
|
location: string;
|
|
6
6
|
}[];
|
|
7
|
-
export type { APIContext,
|
|
8
|
-
export declare const remapFilterSitemap: ((filter: string, context: APIContext, blog?: boolean) => (array: Array<
|
|
7
|
+
export type { APIContext, CombinedPageData };
|
|
8
|
+
export declare const remapFilterSitemap: ((filter: string, context: APIContext, blog?: boolean) => (array: Array<CombinedPageData>) => SiteMapTemplate) & ((array: Array<CombinedPageData>, filter: string, context: APIContext, blog?: boolean) => SiteMapTemplate);
|
|
@@ -10,7 +10,7 @@ const remapFilterSitemap = dual(4, (array, filter, context, blog = false) => {
|
|
|
10
10
|
const newPath = blog ? getBlogRoute(slug) : slug;
|
|
11
11
|
return new URL(pathWithBase(newPath), context.url);
|
|
12
12
|
}
|
|
13
|
-
return array.
|
|
13
|
+
return array.filter(({ package: pkg }) => pkg === filter).map(({ slug }) => ({
|
|
14
14
|
location: genLocation(slug).toString()
|
|
15
15
|
}));
|
|
16
16
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@studiocms/blog",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.31",
|
|
4
4
|
"description": "Add a blog to your StudioCMS project with ease!",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
},
|
|
54
54
|
"type": "module",
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@astrojs/rss": "^4.0.
|
|
56
|
+
"@astrojs/rss": "^4.0.14",
|
|
57
57
|
"astro-integration-kit": "^0.19.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
@@ -61,10 +61,10 @@
|
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"astro": "^5.12.9",
|
|
64
|
-
"effect": "^3.19.
|
|
64
|
+
"effect": "^3.19.9",
|
|
65
65
|
"vite": "^6.3.4",
|
|
66
|
-
"@studiocms/md": "0.1.0-beta.
|
|
67
|
-
"studiocms": "0.1.0-beta.
|
|
66
|
+
"@studiocms/md": "0.1.0-beta.31",
|
|
67
|
+
"studiocms": "0.1.0-beta.31"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|