mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: allow blog posts to be organized by subdirectories
Blog posts can now be structured into subdirectories, which determine their slugs. Example: - `/src/data/blog/2025/testing.md` → `/posts/2025/testing` Directories prefixed with `_` will be excluded from the slug. Example: - `/src/data/blog/_examples/tailwind-typography.md` → `/posts/tailwind-typography` Closes #470, #366
This commit is contained in:
@@ -8,6 +8,7 @@ import Datetime from "@/components/Datetime.astro";
|
||||
import EditPost from "@/components/EditPost.astro";
|
||||
import ShareLinks from "@/components/ShareLinks.astro";
|
||||
import BackButton from "@/components/BackButton.astro";
|
||||
import { getPath } from "@/utils/getPath";
|
||||
import { slugifyStr } from "@/utils/slugify";
|
||||
import IconChevronLeft from "@/assets/icons/IconChevronLeft.svg";
|
||||
import IconChevronRight from "@/assets/icons/IconChevronRight.svg";
|
||||
@@ -45,7 +46,7 @@ if (typeof initOgImage === "string") {
|
||||
|
||||
// Use dynamic OG image if enabled and no remote|local ogImage
|
||||
if (!ogImageUrl && SITE.dynamicOgImage) {
|
||||
ogImageUrl = `/posts/${slugifyStr(title)}/index.png`;
|
||||
ogImageUrl = `${getPath(post.id, post.filePath)}/index.png`;
|
||||
}
|
||||
|
||||
// Resolve OG image URL (or fallback to SITE.ogImage / default `og.png`)
|
||||
|
||||
Reference in New Issue
Block a user