diff --git a/src/pages/now.astro b/src/pages/now.astro index 12a0545..186dc05 100644 --- a/src/pages/now.astro +++ b/src/pages/now.astro @@ -3,16 +3,11 @@ import Layout from '../layouts/Layout.astro' import Footer from '../components/Footer.astro' import Posts from '../components/Posts.astro' import now from '../constants/now.json' -import { dirname, resolve } from 'pathe' -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { mdToHTML } from '../../commands/md-to-html' -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) -const nowMdPath = resolve(__dirname, '../constants/now.md') -const nowContent = readFileSync(nowMdPath, 'utf-8') -const nowHtml = await mdToHTML(nowContent) +const nowGlob = await import.meta.glob('../constants/now.md', { eager: true }) +const nowPosts = Object.values(nowGlob) +const nowHtml = (await nowPosts[0].compiledContent()) ?? '' +console.log('>>>', nowHtml) const publishedOn = now.publishedOn === '' ? now.publishDate : now.publishedOn const posts = await Astro.glob('./now/and-then/posts/*.astro')