diff --git a/src/pages/ads.txt b/public/ads.txt similarity index 100% rename from src/pages/ads.txt rename to public/ads.txt diff --git a/src/pages/blog/[...page].astro b/src/pages/blog/[...page].astro deleted file mode 100644 index bae6a05..0000000 --- a/src/pages/blog/[...page].astro +++ /dev/null @@ -1,31 +0,0 @@ ---- -import type { CollectionEntry } from "astro:content"; -import { getAllPosts, getUniqueCategories, getUniqueTags } from "@/data/post"; -import { collectionDateSort } from "@/utils/date"; -import type { GetStaticPaths, Page } from "astro"; - -export const getStaticPaths = (async ({ paginate }) => { - const MAX_POSTS_PER_PAGE = 20; - const MAX_TAGS = 7; - const MAX_CATEGORIES = 7; - const allPosts = await getAllPosts(); - const uniqueTags = getUniqueTags(allPosts).slice(0, MAX_TAGS); - const uniqueCategories = getUniqueCategories(allPosts).slice(0, MAX_CATEGORIES); - const postsCount = allPosts.length; - return paginate(allPosts.sort(collectionDateSort), { - pageSize: MAX_POSTS_PER_PAGE, - props: { uniqueTags, uniqueCategories, postsCount }, - }); -}) satisfies GetStaticPaths; - -interface Props { - page: Page>; - uniqueTags: string[]; - uniqueCategories: string[]; - postsCount: number; -} - -const currentPath = Astro.url.pathname; -const newPath = currentPath.replace("/blog/", "/posts/"); -return Astro.redirect(newPath); ---- diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index 8b85c4e..d46c51e 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -1,18 +1,4 @@ --- -import { getAllPosts } from "@/data/post"; -import type { GetStaticPaths, InferGetStaticPropsType } from "astro"; - -// if you're using an adaptor in SSR mode, getStaticPaths wont work -> https://docs.astro.build/en/guides/routing/#modifying-the-slug-example-for-ssr -export const getStaticPaths = (async () => { - const blogEntries = await getAllPosts(); - return blogEntries.map((post) => ({ - params: { slug: post.id }, - props: { post }, - })); -}) satisfies GetStaticPaths; - -type Props = InferGetStaticPropsType; - const currentPath = Astro.url.pathname; const newPath = currentPath.replace("/blog/", "/posts/"); return Astro.redirect(newPath); diff --git a/src/pages/category/[category]/[...page].astro b/src/pages/category/[category]/[...page].astro deleted file mode 100644 index b2b42ff..0000000 --- a/src/pages/category/[category]/[...page].astro +++ /dev/null @@ -1,28 +0,0 @@ ---- -import type { CollectionEntry } from "astro:content"; -import { getAllPosts, getUniqueCategories } from "@/data/post"; -import { collectionDateSort } from "@/utils/date"; -import type { GetStaticPaths, Page } from "astro"; - -export const getStaticPaths: GetStaticPaths = async ({ paginate }) => { - const allPosts = await getAllPosts(); - const sortedPosts = allPosts.sort(collectionDateSort); - const uniqueCategories = getUniqueCategories(sortedPosts); - - return uniqueCategories.flatMap((category) => { - const filterPosts = sortedPosts.filter((post) => post.data.category === category); - return paginate(filterPosts, { - pageSize: 20, - params: { category }, - }); - }); -}; - -interface Props { - page: Page>; -} - -const currentPath = Astro.url.pathname; -const newPath = currentPath.replace("/category/", "/categories/"); -return Astro.redirect(newPath); ---- diff --git a/src/pages/category/index.astro b/src/pages/category/index.astro deleted file mode 100644 index ec0cff5..0000000 --- a/src/pages/category/index.astro +++ /dev/null @@ -1,3 +0,0 @@ ---- -return Astro.redirect("/categories"); ---- diff --git a/src/pages/diary/[...slug].astro b/src/pages/diary/[...slug].astro new file mode 100644 index 0000000..a8eaa99 --- /dev/null +++ b/src/pages/diary/[...slug].astro @@ -0,0 +1,5 @@ +--- +const currentPath = Astro.url.pathname; +const newPath = currentPath.replace("/diary/", "/notes/"); +return Astro.redirect(newPath); +--- diff --git a/src/pages/tag/[...slug].astro b/src/pages/tag/[...slug].astro new file mode 100644 index 0000000..ccadc0b --- /dev/null +++ b/src/pages/tag/[...slug].astro @@ -0,0 +1,5 @@ +--- +const currentPath = Astro.url.pathname; +const newPath = currentPath.replace("/tag/", "/tags/"); +return Astro.redirect(newPath); +--- diff --git a/src/pages/tag/[tag]/[...page].astro b/src/pages/tag/[tag]/[...page].astro deleted file mode 100644 index f061fb5..0000000 --- a/src/pages/tag/[tag]/[...page].astro +++ /dev/null @@ -1,28 +0,0 @@ ---- -import type { CollectionEntry } from "astro:content"; -import { getAllPosts, getUniqueTags } from "@/data/post"; -import { collectionDateSort } from "@/utils/date"; -import type { GetStaticPaths, Page } from "astro"; - -export const getStaticPaths: GetStaticPaths = async ({ paginate }) => { - const allPosts = await getAllPosts(); - const sortedPosts = allPosts.sort(collectionDateSort); - const uniqueTags = getUniqueTags(sortedPosts); - - return uniqueTags.flatMap((tag) => { - const filterPosts = sortedPosts.filter((post) => post.data.tags.includes(tag)); - return paginate(filterPosts, { - pageSize: 20, - params: { tag }, - }); - }); -}; - -interface Props { - page: Page>; -} - -const currentPath = Astro.url.pathname; -const newPath = currentPath.replace("/tag/", "/tags/"); -return Astro.redirect(newPath); ---- diff --git a/src/pages/tag/index.astro b/src/pages/tag/index.astro deleted file mode 100644 index e4518d1..0000000 --- a/src/pages/tag/index.astro +++ /dev/null @@ -1,3 +0,0 @@ ---- -return Astro.redirect("/tags"); ----