move blog posts into their own directory
|
@ -1,7 +1,7 @@
|
|||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
export const postsDir = 'src/routes' as const
|
||||
export const postsDir = 'src/routes/(blog)' as const
|
||||
|
||||
export async function listBlogPostSlugs(): Promise<string[]> {
|
||||
await fs.promises.readdir(postsDir)
|
||||
|
@ -55,7 +55,7 @@ export async function getPost(slug: string): Promise<BlogPost | null> {
|
|||
|
||||
const url = new URL(`protocol://-/${slug}`)
|
||||
|
||||
const { default: post, metadata } = await import(`../routes/${slug}/index.svx`)
|
||||
const { default: post, metadata } = await import(`../routes/(blog)/${slug}/index.svx`)
|
||||
|
||||
const result: {
|
||||
title: string
|
||||
|
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 177 KiB After Width: | Height: | Size: 177 KiB |
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 5 KiB After Width: | Height: | Size: 5 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
|
@ -8,7 +8,7 @@ export const load: Load = async ({ params }) => {
|
|||
|
||||
let page
|
||||
try {
|
||||
page = await import(`../../${slug}/index.svx`)
|
||||
page = await import(`../../(blog)/${slug}/index.svx`)
|
||||
} catch (e) {
|
||||
throw error(404, 'Not found')
|
||||
}
|
||||
|
|