Skip to content

Commit

Permalink
use fromFileUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
willpuckett committed Sep 4, 2024
1 parent 7cb0e41 commit 97f0019
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export default async function blog(settings?: BlogSettings) {
html.use(UnoCSS(settings?.unocss)); // Load custom unocss module if provided
html.use(ColorScheme("auto"));

const blogPath = callsites()[1].getFileName()!;
const blogState = await configureBlog(blogPath, IS_DEV, settings);
const url = callsites()[1].getFileName()!;
const blogState = await configureBlog(url, IS_DEV, settings);

const blogHandler = createBlogHandler(blogState);
serve(blogHandler, {
Expand Down Expand Up @@ -166,14 +166,14 @@ function composeMiddlewares(state: BlogState) {
}

export async function configureBlog(
blogPath: string,
url: string,
isDev: boolean,
settings?: BlogSettings,
): Promise<BlogState> {
let directory;

try {
// const blogPath = fromFileUrl(`file://${url}`);
const blogPath = fromFileUrl(`file://${url}`);
directory = dirname(blogPath);
} catch (e) {
console.error(e);
Expand Down

0 comments on commit 97f0019

Please sign in to comment.