Skip to content

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: await Promise.all(
5854
allBlogPosts.map(createRecentPostModule),

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
import React from "react";
2-
import styles from "./Home.module.css";
2+
import styles from "./FeaturedPosts.module.css";
33
import Layout from "@theme/Layout";
44
import { Content } from "@theme/BlogPostPage";
55
import clsx from "clsx";
66

7-
interface HomeProps {
7+
interface FeaturedPostsProps {
88
readonly blogPosts: readonly { readonly Preview: Content; metadata: any }[];
99
}
1010

11-
function Home({ blogPosts }: HomeProps): JSX.Element {
11+
function FeaturedPosts({ blogPosts }: FeaturedPostsProps): JSX.Element {
1212
return (
1313
<Layout>
1414
<div className="container margin-top--lg margin-bottom--lg">
@@ -19,11 +19,11 @@ function Home({ blogPosts }: HomeProps): JSX.Element {
1919
</div>
2020
<div className="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-
export default Home;
35+
export default FeaturedPosts;
3636

37-
export function HomeCard({ index, metadata, context }): JSX.Element {
37+
export function FeaturedPostsCard({ index, metadata, context }): JSX.Element {
3838
return (
3939
<div className={`${clsx("col col--3 col--offset-1")} ${styles.card}`}>
4040
<div className="text--center">

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy