@studiocms/blog 0.1.0-beta.24 → 0.1.0-beta.25
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/Navigation.astro +5 -4
- package/dist/index.js +1 -1
- package/dist/layouts/Layout.astro +1 -1
- package/dist/routes/blog/index.astro +1 -1
- package/dist/routes/rss.xml.d.ts +1 -2
- package/dist/routes/rss.xml.js +20 -11
- package/dist/routes/sitemap-md.xml.d.ts +1 -2
- package/dist/routes/sitemap-md.xml.js +12 -5
- package/dist/routes/sitemap-posts.xml.d.ts +1 -2
- package/dist/routes/sitemap-posts.xml.js +12 -8
- package/dist/types.d.ts +9 -9
- package/dist/types.js +1 -1
- package/package.json +8 -8
|
@@ -8,12 +8,13 @@ type Props = {
|
|
|
8
8
|
|
|
9
9
|
const { topLevelLinkCount = 3 } = Astro.props;
|
|
10
10
|
|
|
11
|
-
const config = Astro.locals.siteConfig.data;
|
|
11
|
+
const config = Astro.locals.StudioCMS.siteConfig.data;
|
|
12
12
|
|
|
13
13
|
const { title } = config || { title: 'StudioCMS' };
|
|
14
14
|
const {
|
|
15
15
|
mainLinks: { baseSiteURL },
|
|
16
|
-
|
|
16
|
+
authLinks: { loginURL },
|
|
17
|
+
} = Astro.locals.StudioCMS.routeMap;
|
|
17
18
|
|
|
18
19
|
type LinkProps = {
|
|
19
20
|
text: string;
|
|
@@ -43,7 +44,7 @@ const links: LinkProps[] = await frontendNavigation();
|
|
|
43
44
|
))
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
<a class="avatar" href={
|
|
47
|
+
<a class="avatar" href={loginURL}>Dashboard</a>
|
|
47
48
|
</div>
|
|
48
49
|
) }
|
|
49
50
|
|
|
@@ -76,6 +77,6 @@ const links: LinkProps[] = await frontendNavigation();
|
|
|
76
77
|
</div>
|
|
77
78
|
</div>
|
|
78
79
|
|
|
79
|
-
<a class="avatar" href={
|
|
80
|
+
<a class="avatar" href={loginURL}>Dashboard</a>
|
|
80
81
|
</div>
|
|
81
82
|
) }
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { addVirtualImports, createResolver } from "astro-integration-kit";
|
|
2
|
-
import { pathWithBase } from "studiocms/lib/pathGenerators
|
|
2
|
+
import { pathWithBase } from "studiocms/lib/pathGenerators";
|
|
3
3
|
import { definePlugin } from "studiocms/plugins";
|
|
4
4
|
import { FrontEndConfigSchema } from "./types.js";
|
|
5
5
|
const packageIdentifier = "@studiocms/blog";
|
|
@@ -4,7 +4,7 @@ import BaseHead from '../components/BaseHead.astro';
|
|
|
4
4
|
import Footer from '../components/Footer.astro';
|
|
5
5
|
import Navigation from '../components/Navigation.astro';
|
|
6
6
|
|
|
7
|
-
const { title: SiteTitle, description: SiteDescription } = Astro.locals.siteConfig.data;
|
|
7
|
+
const { title: SiteTitle, description: SiteDescription } = Astro.locals.StudioCMS.siteConfig.data;
|
|
8
8
|
|
|
9
9
|
let htmlDefaultLanguage = 'en';
|
|
10
10
|
|
|
@@ -5,7 +5,7 @@ import PageList from '../../components/PageList.astro';
|
|
|
5
5
|
import RSSIcon from '../../components/RSSIcon.astro';
|
|
6
6
|
import Layout from '../../layouts/Layout.astro';
|
|
7
7
|
|
|
8
|
-
const config = Astro.locals.siteConfig.data;
|
|
8
|
+
const config = Astro.locals.StudioCMS.siteConfig.data;
|
|
9
9
|
|
|
10
10
|
// Set the title and description
|
|
11
11
|
const { description: configDescription } = config;
|
package/dist/routes/rss.xml.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GET: APIRoute;
|
|
1
|
+
export declare const GET: import("astro").APIRoute;
|
package/dist/routes/rss.xml.js
CHANGED
|
@@ -2,7 +2,7 @@ import blogConfig from "studiocms:blog/config";
|
|
|
2
2
|
import { pathWithBase } from "studiocms:lib";
|
|
3
3
|
import { SDKCore } from "studiocms:sdk";
|
|
4
4
|
import rss, {} from "@astrojs/rss";
|
|
5
|
-
import {
|
|
5
|
+
import { createJsonResponse, Effect, withEffectAPI } from "studiocms/effect";
|
|
6
6
|
const blogRouteFullPath = `${blogConfig.route}/[...slug]`;
|
|
7
7
|
function getBlogRoute(slug) {
|
|
8
8
|
if (blogRouteFullPath) {
|
|
@@ -10,19 +10,21 @@ function getBlogRoute(slug) {
|
|
|
10
10
|
}
|
|
11
11
|
return "#";
|
|
12
12
|
}
|
|
13
|
-
const GET =
|
|
14
|
-
|
|
13
|
+
const GET = withEffectAPI(
|
|
14
|
+
Effect.fn(function* ({ site: _site, locals }) {
|
|
15
15
|
const sdk = yield* SDKCore;
|
|
16
|
-
const config =
|
|
17
|
-
const
|
|
16
|
+
const config = locals?.StudioCMS?.siteConfig?.data;
|
|
17
|
+
const siteTitle = config?.title ?? "StudioCMS";
|
|
18
|
+
const title = `${siteTitle} | ${blogConfig.title}`;
|
|
18
19
|
const description = config?.description ?? "Blog";
|
|
19
|
-
const site =
|
|
20
|
+
const site = _site ?? "https://example.com";
|
|
20
21
|
const posts = yield* sdk.GET.pages();
|
|
21
|
-
const
|
|
22
|
-
const items =
|
|
23
|
-
({ title: title2, description: description2, publishedAt
|
|
22
|
+
const sortedPosts = posts.map(({ data }) => data).filter(({ package: pkg }) => pkg === "@studiocms/blog").sort((a, b) => new Date(b.publishedAt).getTime() - new Date(a.publishedAt).getTime());
|
|
23
|
+
const items = sortedPosts.map(
|
|
24
|
+
({ title: title2, description: description2, publishedAt, slug, categories: categoryData }) => {
|
|
24
25
|
const link = pathWithBase(getBlogRoute(slug));
|
|
25
|
-
const categories = categoryData.map(({ name }) => name);
|
|
26
|
+
const categories = (categoryData ?? []).map(({ name }) => name);
|
|
27
|
+
const pubDate = typeof publishedAt === "string" ? new Date(publishedAt) : publishedAt;
|
|
26
28
|
return {
|
|
27
29
|
title: title2,
|
|
28
30
|
description: description2,
|
|
@@ -33,7 +35,14 @@ const GET = async (context) => await convertToVanilla(
|
|
|
33
35
|
}
|
|
34
36
|
);
|
|
35
37
|
return rss({ title, description, site, items });
|
|
36
|
-
})
|
|
38
|
+
}),
|
|
39
|
+
{
|
|
40
|
+
cors: { methods: ["GET"], origin: "*" },
|
|
41
|
+
onError: async (error) => {
|
|
42
|
+
console.error("Error generating RSS feed:", error);
|
|
43
|
+
return createJsonResponse({ error: "Something went wrong" }, { status: 500 });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
);
|
|
38
47
|
export {
|
|
39
48
|
GET
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GET: APIRoute;
|
|
1
|
+
export declare const GET: import("astro").APIRoute;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { SDKCore } from "studiocms:sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { createJsonResponse, Effect, pipe, withEffectAPI } from "studiocms/effect";
|
|
3
3
|
import { remapFilterSitemap } from "../utils/remapFilter.js";
|
|
4
4
|
const template = (entries) => `<?xml version="1.0" encoding="UTF-8"?>
|
|
5
5
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
6
6
|
${entries.map((entry) => `<url><loc>${entry.location}</loc></url>`).join("")}
|
|
7
7
|
</urlset>`;
|
|
8
|
-
const GET =
|
|
9
|
-
|
|
8
|
+
const GET = withEffectAPI(
|
|
9
|
+
Effect.fn(function* (ctx) {
|
|
10
10
|
const sdk = yield* SDKCore;
|
|
11
|
-
const posts = pipe(yield* sdk.GET.pages(), remapFilterSitemap("studiocms/markdown",
|
|
11
|
+
const posts = pipe(yield* sdk.GET.pages(), remapFilterSitemap("studiocms/markdown", ctx));
|
|
12
12
|
const sitemap = template(posts);
|
|
13
13
|
return new Response(sitemap, {
|
|
14
14
|
status: 200,
|
|
@@ -16,7 +16,14 @@ const GET = async (context) => await convertToVanilla(
|
|
|
16
16
|
"Content-Type": "application/xml"
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
{
|
|
21
|
+
cors: { methods: ["GET"], origin: "*" },
|
|
22
|
+
onError: async (error) => {
|
|
23
|
+
console.error("Sitemap API Error:", error);
|
|
24
|
+
return createJsonResponse({ error: "Something went wrong" }, { status: 500 });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
20
27
|
);
|
|
21
28
|
export {
|
|
22
29
|
GET
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GET: APIRoute;
|
|
1
|
+
export declare const GET: import("astro").APIRoute;
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { SDKCore } from "studiocms:sdk";
|
|
2
|
-
import {
|
|
2
|
+
import { createJsonResponse, Effect, pipe, withEffectAPI } from "studiocms/effect";
|
|
3
3
|
import { remapFilterSitemap } from "../utils/remapFilter.js";
|
|
4
4
|
const template = (entries) => `<?xml version="1.0" encoding="UTF-8"?>
|
|
5
5
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
6
6
|
${entries.map((entry) => `<url><loc>${entry.location}</loc></url>`).join("")}
|
|
7
7
|
</urlset>`;
|
|
8
|
-
const GET =
|
|
9
|
-
|
|
8
|
+
const GET = withEffectAPI(
|
|
9
|
+
Effect.fn(function* (ctx) {
|
|
10
10
|
const sdk = yield* SDKCore;
|
|
11
|
-
const posts = pipe(
|
|
12
|
-
yield* sdk.GET.pages(),
|
|
13
|
-
remapFilterSitemap("@studiocms/blog", context, true)
|
|
14
|
-
);
|
|
11
|
+
const posts = pipe(yield* sdk.GET.pages(), remapFilterSitemap("@studiocms/blog", ctx, true));
|
|
15
12
|
const sitemap = template(posts);
|
|
16
13
|
return new Response(sitemap, {
|
|
17
14
|
status: 200,
|
|
@@ -19,7 +16,14 @@ const GET = async (context) => await convertToVanilla(
|
|
|
19
16
|
"Content-Type": "application/xml"
|
|
20
17
|
}
|
|
21
18
|
});
|
|
22
|
-
})
|
|
19
|
+
}),
|
|
20
|
+
{
|
|
21
|
+
cors: { methods: ["GET"], origin: "*" },
|
|
22
|
+
onError: async (error) => {
|
|
23
|
+
console.error("Sitemap API Error:", error);
|
|
24
|
+
return createJsonResponse({ error: "Something went wrong" }, { status: 500 });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
23
27
|
);
|
|
24
28
|
export {
|
|
25
29
|
GET
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
|
-
import { HeadConfigSchema } from 'studiocms/lib/head
|
|
2
|
+
import { HeadConfigSchema } from 'studiocms/lib/head';
|
|
3
3
|
export type HeadUserConfig = z.input<ReturnType<typeof HeadConfigSchema>>;
|
|
4
4
|
export type HeadConfig = z.output<ReturnType<typeof HeadConfigSchema>>;
|
|
5
5
|
/**
|
|
@@ -19,13 +19,13 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
19
19
|
attrs: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodBoolean, z.ZodUndefined]>>>;
|
|
20
20
|
content: z.ZodDefault<z.ZodString>;
|
|
21
21
|
}, "strip", z.ZodTypeAny, {
|
|
22
|
-
tag: "
|
|
23
|
-
attrs: Record<string, string | boolean | undefined>;
|
|
22
|
+
tag: "title" | "link" | "base" | "meta" | "noscript" | "script" | "style" | "template";
|
|
24
23
|
content: string;
|
|
24
|
+
attrs: Record<string, string | boolean | undefined>;
|
|
25
25
|
}, {
|
|
26
|
-
tag: "
|
|
27
|
-
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
26
|
+
tag: "title" | "link" | "base" | "meta" | "noscript" | "script" | "style" | "template";
|
|
28
27
|
content?: string | undefined;
|
|
28
|
+
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
29
29
|
}>, "many">>;
|
|
30
30
|
/**
|
|
31
31
|
* Favicon Configuration - The default favicon configuration for the Frontend
|
|
@@ -71,9 +71,9 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
71
71
|
}, "strip", z.ZodTypeAny, {
|
|
72
72
|
htmlDefaultLanguage: string;
|
|
73
73
|
htmlDefaultHead: {
|
|
74
|
-
tag: "
|
|
75
|
-
attrs: Record<string, string | boolean | undefined>;
|
|
74
|
+
tag: "title" | "link" | "base" | "meta" | "noscript" | "script" | "style" | "template";
|
|
76
75
|
content: string;
|
|
76
|
+
attrs: Record<string, string | boolean | undefined>;
|
|
77
77
|
}[];
|
|
78
78
|
favicon: string;
|
|
79
79
|
sitemap: boolean;
|
|
@@ -86,9 +86,9 @@ export declare const FrontEndConfigSchema: z.ZodDefault<z.ZodOptional<z.ZodObjec
|
|
|
86
86
|
}, {
|
|
87
87
|
htmlDefaultLanguage?: string | undefined;
|
|
88
88
|
htmlDefaultHead?: {
|
|
89
|
-
tag: "
|
|
90
|
-
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
89
|
+
tag: "title" | "link" | "base" | "meta" | "noscript" | "script" | "style" | "template";
|
|
91
90
|
content?: string | undefined;
|
|
91
|
+
attrs?: Record<string, string | boolean | undefined> | undefined;
|
|
92
92
|
}[] | undefined;
|
|
93
93
|
favicon?: string | undefined;
|
|
94
94
|
sitemap?: boolean | undefined;
|
package/dist/types.js
CHANGED
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.25",
|
|
4
4
|
"description": "Add a blog to your StudioCMS project with ease!",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "withstudiocms",
|
|
@@ -53,21 +53,21 @@
|
|
|
53
53
|
"type": "module",
|
|
54
54
|
"dependencies": {
|
|
55
55
|
"@astrojs/rss": "^4.0.12",
|
|
56
|
-
"astro-integration-kit": "^0.
|
|
56
|
+
"astro-integration-kit": "^0.19.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/node": "^22.0.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"astro": "^5.12.
|
|
63
|
-
"effect": "^3.17.
|
|
62
|
+
"astro": "^5.12.9",
|
|
63
|
+
"effect": "^3.17.9",
|
|
64
64
|
"vite": "^6.3.4",
|
|
65
|
-
"@studiocms/md": "0.1.0-beta.
|
|
66
|
-
"studiocms": "0.1.0-beta.
|
|
65
|
+
"@studiocms/md": "0.1.0-beta.25",
|
|
66
|
+
"studiocms": "0.1.0-beta.25"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
|
-
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
|
|
70
|
-
"dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png}'",
|
|
69
|
+
"build": "buildkit build 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|
|
70
|
+
"dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png,d.ts}'",
|
|
71
71
|
"typecheck": "tspc -p tsconfig.tspc.json"
|
|
72
72
|
}
|
|
73
73
|
}
|