diff --git a/website/src/pages/archive/[...page].astro b/website/src/pages/archive/[...page].astro deleted file mode 100644 index 142f9c5a..00000000 --- a/website/src/pages/archive/[...page].astro +++ /dev/null @@ -1,39 +0,0 @@ ---- -import DailyEmailForm from '../../components/DailyEmailForm.astro' -import Layout from '../../layouts/DailyEmailLayout.astro' - -export async function getStaticPaths({ paginate }) { - const emails = await Astro.glob('../../daily-emails/*.md') - const sortedEmails = emails - .sort((a, b) => - new Date(b.frontmatter.pubDate).valueOf() - - new Date(a.frontmatter.pubDate).valueOf() - ) - - return paginate(sortedEmails, { pageSize: 20 }) -} - -const { page } = Astro.props; ---- - - - - - - diff --git a/website/src/pages/archive/[...slug].astro b/website/src/pages/archive/[...slug].astro new file mode 100644 index 00000000..73bc6b30 --- /dev/null +++ b/website/src/pages/archive/[...slug].astro @@ -0,0 +1,28 @@ +--- +import DailyEmailForm from '../../components/DailyEmailForm.astro' +import Layout from '../../layouts/DailyEmailLayout.astro' + +export async function getStaticPaths() { + const emails = await Astro.glob('../../daily-emails/*.md') + + return emails.map(email => { + return { + params: { + slug: email.frontmatter.permalink + .replace('archive/', '') + .replace('\n', ''), + }, + props: { + email, + } + } + }) +} + +const { Content } = Astro.props.email +const { title } = Astro.props.email.frontmatter +--- + + + + diff --git a/website/src/pages/archive/index.astro b/website/src/pages/archive/index.astro new file mode 100644 index 00000000..e0041d95 --- /dev/null +++ b/website/src/pages/archive/index.astro @@ -0,0 +1,28 @@ +--- +import PageLayout from '../../layouts/PageLayout.astro' + +const emails = await Astro.glob('../../daily-emails/*.md'); + +const sortedEmails = emails + .sort((a, b) => + new Date(b.frontmatter.pubDate).valueOf() - + new Date(a.frontmatter.pubDate).valueOf() + ) +--- + + + +