From d7f56919851192c1e68af34f8a0d4571a2d25149 Mon Sep 17 00:00:00 2001 From: AruSeito <41471697+AruSeito@users.noreply.github.com> Date: Thu, 21 Dec 2023 21:57:07 +0800 Subject: [PATCH] init --- plugins/blog-plugin.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/blog-plugin.js b/plugins/blog-plugin.js index 594834b3fb..0d79702e30 100644 --- a/plugins/blog-plugin.js +++ b/plugins/blog-plugin.js @@ -129,6 +129,7 @@ async function blogPluginExtended(...pluginArgs) { blogTagsListPath, } = blogContents; + const blogItemsToMetadata = {}; function blogPostItemsModule(items) { @@ -157,9 +158,11 @@ async function blogPluginExtended(...pluginArgs) { (post) => post.metadata.frontMatter.is_featured !== true, ); + const basePageUrl = blogTagsListPath.split("/tags")[0] + const blogListPaginated = paginateBlogPosts({ blogPosts, - basePageUrl: "/illa-website/blog", + basePageUrl: basePageUrl, blogTitle, blogDescription, postsPerPageOption: postsPerPage, @@ -181,6 +184,7 @@ async function blogPluginExtended(...pluginArgs) { JSON.stringify({ ...metadata, relatedPosts, authorPosts }, null, 2), ); + addRoute({ path: metadata.permalink, component: "@theme/BlogPostPage", @@ -216,7 +220,6 @@ async function blogPluginExtended(...pluginArgs) { JSON.stringify(tagsProp, null, 2), ); - console.log("permalink", permalink) addRoute({ path: permalink, @@ -224,7 +227,7 @@ async function blogPluginExtended(...pluginArgs) { exact: true, modules: { items: blogPostItemsModule( - permalink === "/illa-website/blog" + permalink === basePageUrl ? [...items, ...featuredBlogPosts.map((post) => post.id)] : items, ),