feat: add emoji support
This commit is contained in:
parent
559bb72b91
commit
424c7b2ff4
6 changed files with 56 additions and 27 deletions
|
|
@ -3,17 +3,17 @@ import type { BlogPostFrontmatter, BlogPostMeta } from '../../types';
|
|||
export async function GET() {
|
||||
const modules = import.meta.glob('./*.svx');
|
||||
const posts: BlogPostMeta[] = [];
|
||||
|
||||
const resolved = (await Promise.all(Object.values(modules).map((f) => f()))) as {
|
||||
metadata: BlogPostFrontmatter;
|
||||
}[];
|
||||
resolved.forEach((file, index) => {
|
||||
const path = Object.keys(modules)[index];
|
||||
const { metadata } = file;
|
||||
|
||||
resolved.forEach(({ metadata }, index) => {
|
||||
const path = Object.keys(modules)[index].replace('.svx', '');
|
||||
if (!metadata.hidden) posts.push({ ...metadata, href: `blog/${path}` });
|
||||
if (!metadata.hidden) posts.push({ ...metadata, href: `blog/${path.replace('.svx', '')}` });
|
||||
});
|
||||
|
||||
posts.sort((a, b) => new Date(b.date).valueOf() - new Date(a.date).valueOf());
|
||||
posts.sort((a, b) => new Date(b.created).valueOf() - new Date(a.created).valueOf());
|
||||
|
||||
return {
|
||||
body: { posts },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue