Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit c962876

Browse files
committed
blog featured posts
1 parent 1e80f1a commit c962876

File tree

3 files changed

+10
-14
lines changed

3 files changed

+10
-14
lines changed

‎plugins/blog-plugin.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,11 @@ async function blogPluginExtended(...pluginOptions){
4444
};
4545
}
4646

47-
// Create the gallery page
4847
data.actions.addRoute({
49-
// Add route for the home page
50-
path: "/home",
48+
path: "/featured-posts",
5149
exact: true,
5250

53-
// The component to use for the "Home" page route
54-
component: "@site/src/components/Home/Home.tsx",
55-
// These are the props that will be passed to our "Home" page component
51+
component: "@site/src/components/FeaturedPosts/FeaturedPosts.tsx",
5652
modules: {
5753
blogPosts: awaitPromise.all(
5854
allBlogPosts.map(createRecentPostModule),
File renamed without changes.

src/components/Home/Home.tsx renamed to src/components/FeaturedPosts/FeaturedPosts.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
importReactfrom"react";
2-
importstylesfrom"./Home.module.css";
2+
importstylesfrom"./FeaturedPosts.module.css";
33
importLayoutfrom"@theme/Layout";
44
import{Content}from"@theme/BlogPostPage";
55
importclsxfrom"clsx";
66

7-
interfaceHomeProps{
7+
interfaceFeaturedPostsProps{
88
readonlyblogPosts: readonly{readonlyPreview: Content;metadata: any}[];
99
}
1010

11-
functionHome({ blogPosts }: HomeProps): JSX.Element{
11+
functionFeaturedPosts({ blogPosts }: FeaturedPostsProps): JSX.Element{
1212
return(
1313
<Layout>
1414
<divclassName="container margin-top--lg margin-bottom--lg">
@@ -19,11 +19,11 @@ function Home({blogPosts }: HomeProps): JSX.Element{
1919
</div>
2020
<divclassName="row">
2121
{blogPosts.map(({ metadata },index)=>(
22-
<HomeCard
23-
key={`${metadata.date}-${index}-home`}
22+
<FeaturedPostsCard
23+
key={`${metadata.date}-${index}-featured-posts`}
2424
index={index}
2525
metadata={metadata}
26-
context={"home"}
26+
context={"featured-posts"}
2727
/>
2828
))}
2929
</div>
@@ -32,9 +32,9 @@ function Home({blogPosts }: HomeProps): JSX.Element{
3232
);
3333
}
3434

35-
exportdefaultHome;
35+
exportdefaultFeaturedPosts;
3636

37-
exportfunctionHomeCard({ index, metadata, context }): JSX.Element{
37+
exportfunctionFeaturedPostsCard({ index, metadata, context }): JSX.Element{
3838
return(
3939
<divclassName={`${clsx("col col--3 col--offset-1")}${styles.card}`}>
4040
<divclassName="text--center">

0 commit comments

Comments
(0)