Updates
This commit is contained in:
@@ -4,7 +4,10 @@ import {
|
||||
} from "@/db/types/db";
|
||||
import { PagePropsType } from "@/src/types";
|
||||
import BunMariaDB from "@moduletrace/bun-mariadb";
|
||||
import { BunextPageServerFn } from "@moduletrace/bunext/types";
|
||||
import {
|
||||
BunextPageServerFn,
|
||||
BunextPageSitemapFn,
|
||||
} from "@moduletrace/bunext/types";
|
||||
|
||||
export const server: BunextPageServerFn<PagePropsType> = async (ctx) => {
|
||||
const blog_post = await BunMariaDB.select<
|
||||
@@ -38,3 +41,30 @@ export const server: BunextPageServerFn<PagePropsType> = async (ctx) => {
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const sitemap: BunextPageSitemapFn = async ({ route }) => {
|
||||
const blog_post = await BunMariaDB.select<
|
||||
BUN_MARIADB_DATASQUIREL_USER_2_TBENME_BLOG_POSTS,
|
||||
(typeof BunMariaDBTables)[number]
|
||||
>({
|
||||
table: "blog_posts",
|
||||
query: {
|
||||
query: {
|
||||
published: {
|
||||
value: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
return (
|
||||
blog_post.payload?.map((bp) => {
|
||||
return {
|
||||
path: `/blog/${bp.slug}`,
|
||||
lastmod: bp.date_updated_code
|
||||
? new Date(Number(bp.date_updated_code))
|
||||
: undefined,
|
||||
};
|
||||
}) || []
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user