@studiocms/blog 0.1.0-beta.13 → 0.1.0-beta.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studiocms/blog",
3
- "version": "0.1.0-beta.13",
3
+ "version": "0.1.0-beta.15",
4
4
  "description": "Add a blog to your StudioCMS project with ease!",
5
5
  "author": {
6
6
  "name": "Adam Matthiesen | Jacob Jenkins | Paul Valladares",
@@ -61,12 +61,12 @@
61
61
  "@types/node": "^22.0.0"
62
62
  },
63
63
  "peerDependencies": {
64
- "astro": "^5.5.0",
65
- "vite": "^6.2.0",
66
- "studiocms": "0.1.0-beta.13"
64
+ "astro": "^5.6.0",
65
+ "vite": "^6.2.5",
66
+ "studiocms": "0.1.0-beta.15"
67
67
  },
68
68
  "scripts": {
69
- "build": "build-scripts build 'src/**/*.{ts,css}'",
70
- "dev": "build-scripts dev 'src/**/*.{ts,css}'"
69
+ "build": "buildkit build 'src/**/*.{ts,astro,css,json,png}'",
70
+ "dev": "buildkit dev 'src/**/*.{ts,astro,css,json,png}'"
71
71
  }
72
72
  }
package/dist/blog.d.js DELETED
File without changes
File without changes
package/dist/lib.d.js DELETED
File without changes
File without changes
@@ -1,44 +0,0 @@
1
- import blogConfig from 'studiocms:blog/config';
2
- import { pathWithBase } from 'studiocms:lib';
3
- import studioCMS_SDK from 'studiocms:sdk/cache';
4
- import rss, { type RSSFeedItem } from '@astrojs/rss';
5
- import type { APIContext } from 'astro';
6
-
7
- const blogRouteFullPath = `${blogConfig.route}/[...slug]`;
8
-
9
- function getBlogRoute(slug: string) {
10
- if (blogRouteFullPath) {
11
- return blogRouteFullPath.replace('[...slug]', slug);
12
- }
13
- return '#';
14
- }
15
-
16
- export async function GET(context: APIContext) {
17
- // Get Config from Studio Database
18
- const config = (await studioCMS_SDK.GET.siteConfig()).data || {
19
- title: 'StudioCMS - Database Unavailable',
20
- description: 'StudioCMS - Database Unavailable',
21
- };
22
-
23
- // Set Title, Description, and Site
24
- const title = `${config?.title} | ${blogConfig.title}`;
25
- const description = config?.description ?? 'Blog';
26
- const site = context.site ?? 'https://example.com';
27
-
28
- // Get all Posts from Studio Database
29
- const orderedPosts = (await studioCMS_SDK.GET.pages())
30
- .map(({ data }) => data)
31
- .filter(({ package: pkg }) => pkg === '@studiocms/blog');
32
-
33
- const items: RSSFeedItem[] = orderedPosts.map((post) => {
34
- return {
35
- title: post.title,
36
- description: post.description,
37
- pubDate: post.publishedAt,
38
- link: pathWithBase(getBlogRoute(post.slug)),
39
- categories: post.categories.map(({ name }) => name),
40
- };
41
- });
42
-
43
- return rss({ title, description, site, items });
44
- }
@@ -1,28 +0,0 @@
1
- import { pathWithBase } from 'studiocms:lib';
2
- import studioCMS_SDK from 'studiocms:sdk/cache';
3
- import type { APIContext, APIRoute } from 'astro';
4
-
5
- const template = (entries: { location: string }[]) => `<?xml version="1.0" encoding="UTF-8"?>
6
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
7
- ${entries.map((entry) => `<url><loc>${entry.location}</loc></url>`).join('')}
8
- </urlset>`;
9
-
10
- export const GET: APIRoute = async (context: APIContext) => {
11
- // Get all Posts from Studio Database
12
- const orderedPosts = (await studioCMS_SDK.GET.pages())
13
- .map(({ data }) => data)
14
- .filter(({ package: pkg }) => pkg === 'studiocms/markdown');
15
-
16
- const sitemapLinks = orderedPosts.map((post) => ({
17
- location: new URL(pathWithBase(post.slug), context.url).toString(),
18
- }));
19
-
20
- const sitemap = template(sitemapLinks);
21
-
22
- return new Response(sitemap, {
23
- status: 200,
24
- headers: {
25
- 'Content-Type': 'application/xml',
26
- },
27
- });
28
- };
@@ -1,38 +0,0 @@
1
- import blogConfig from 'studiocms:blog/config';
2
- import { pathWithBase } from 'studiocms:lib';
3
- import studioCMS_SDK from 'studiocms:sdk/cache';
4
- import type { APIContext, APIRoute } from 'astro';
5
-
6
- const blogRouteFullPath = `${blogConfig.route}/[...slug]`;
7
-
8
- function getBlogRoute(slug: string) {
9
- if (blogRouteFullPath) {
10
- return blogRouteFullPath.replace('[...slug]', slug);
11
- }
12
- return '#';
13
- }
14
-
15
- const template = (entries: { location: string }[]) => `<?xml version="1.0" encoding="UTF-8"?>
16
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
17
- ${entries.map((entry) => `<url><loc>${entry.location}</loc></url>`).join('')}
18
- </urlset>`;
19
-
20
- export const GET: APIRoute = async (context: APIContext) => {
21
- // Get all Posts from Studio Database
22
- const orderedPosts = (await studioCMS_SDK.GET.pages())
23
- .map(({ data }) => data)
24
- .filter(({ package: pkg }) => pkg === '@studiocms/blog');
25
-
26
- const sitemapLinks = orderedPosts.map((post) => ({
27
- location: new URL(pathWithBase(getBlogRoute(post.slug)), context.url).toString(),
28
- }));
29
-
30
- const sitemap = template(sitemapLinks);
31
-
32
- return new Response(sitemap, {
33
- status: 200,
34
- headers: {
35
- 'Content-Type': 'application/xml',
36
- },
37
- });
38
- };
package/dist/sdk.d.js DELETED
File without changes