Skip to content

Commit 1e80f1a

Browse files
committed
blog home page
1 parent 87fcbd1 commit 1e80f1a

File tree

20 files changed

+290
-54
lines changed

20 files changed

+290
-54
lines changed

blog/ai-code-reviews-reclaims-2023-10-05/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: How AI Code Review Reclaims Your Team's Time
44
description: How AI Code Review Reclaims Your Team's Time
55
authors: [simone]
66
tags: ["AI", "Code Review", "Productivity"]
7-
image: ./preview.png
7+
image: /img/blog-previews/ai-code-reviews-reclaims.png
88
---
99

1010
### Introduction

blog/ai-transforming-traditional-code-review-practices-2024-03-29/blog.md

+127-35
Large diffs are not rendered by default.

blog/boosting-engineering-efficiency-2023-11-13/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description:
55
In a world where the office is just a step away from your bed, we dive into
66
the challenges and triumphs of maintaining code quality across continents.
77
authors: [dotlabs]
8-
image: ./preview.jpeg
8+
image: /img/blog-previews/boosting-engineering-efficiency.jpeg
99
tags: ["AI", "Code Reviews", "Remote Work"]
1010
---
1111

blog/coderabbit-deep-dive-2023-08-26/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: AI and the Future of Code Reviews - A Deep Dive into CodeRabbit
44
description: AI and the Future of Code Reviews - A Deep Dive into CodeRabbit
55
authors: [gur, vishu]
66
tags: ["CodeRabbit", "AI", "Code Reviews"]
7-
image: ./preview.jpeg
7+
image: /img/blog-previews/coderabbit-deep-dive.jpeg
88
---
99

1010
We are witnessing an inflection point in the software development industry.

blog/fluxninja-acquisition-2024-03-17/blog.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ tags:
1616
"Caching",
1717
"Scheduler",
1818
]
19-
image: ./preview.png
19+
image: /img/blog-previews/fluxninja-acquisition.png
2020
---
2121

22-
![FluxNinja joins CodeRabbit](./preview.png)
22+
![FluxNinja joins CodeRabbit](/img/blog-previews/fluxninja-acquisition.png)
2323

2424
We are excited to announce that CodeRabbit has acquired
2525
[FluxNinja](https://fluxninja.com), a startup that provides a platform for

blog/how-we-built-cost-effective-generative-ai-application-2023-12-23/blog.md

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description:
66
effective and improve user experience.
77
authors: [gur]
88
tags: ["AI", "Cost Optimization", "Generative AI", "Code Review"]
9+
image: /img/blog-previews/how-we-built-cost-effective-generative-ai-application.png
910
---
1011

1112
# How we built a cost-effective Generative AI application

blog/modern-ai-stack-for-developer-productivity-2024-01-05/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: Modern AI stack for developer productivity
44
description:
55
Elevate your development workflow with three pillars of developer productivity
66
tools powered by Artificial Intelligence
7-
image: ./preview.jpg
7+
image: /img/blog-previews/modern-ai-stack-for-developer-productivity.jpg
88
authors: [pradeep]
99
tags: ["AI", "Developer Tools", "Code Generation", "Code Review", "Knowledge"]
1010
---

blog/openai-rate-limits-2023-10-23/blog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description:
77
How CodeRabbit uses Aperture to manage OpenAI rate limits with request
88
prioritization
99
authors: [gur, sumanvs, nato]
10-
image: ./preview.png
10+
image: /img/blog-previews/openai-rate-limits.png
1111
tags: ["AI", "OpenAI", "Rate Limits", "Aperture"]
1212
---
1313

docusaurus.config.ts

+18-12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@ const config: Config = {
3535
},
3636

3737
plugins: [
38+
[
39+
"./plugins/blog-plugin",
40+
{
41+
id: "blog",
42+
routeBasePath: "blog",
43+
path: "./blog",
44+
blogTitle: "CodeRabbit Blog",
45+
blogDescription: "Blog",
46+
tagsBasePath: "/tags",
47+
editLocalizedFiles: false,
48+
showReadingTime: true,
49+
blogSidebarCount: "ALL",
50+
blogSidebarTitle: "All our posts",
51+
blogListComponent: "@theme/BlogListPage",
52+
blogPostComponent: "@theme/BlogPostPage",
53+
},
54+
],
3855
[
3956
"@docusaurus/plugin-client-redirects",
4057
{
@@ -77,18 +94,7 @@ const config: Config = {
7794
breadcrumbs: true,
7895
showLastUpdateTime: true,
7996
},
80-
blog: {
81-
blogTitle: "CodeRabbit Blog",
82-
blogDescription: "Blog",
83-
tagsBasePath: "/tags",
84-
editLocalizedFiles: false,
85-
routeBasePath: "/blog",
86-
showReadingTime: true,
87-
blogSidebarCount: "ALL",
88-
blogSidebarTitle: "All our posts",
89-
blogListComponent: "@theme/BlogListPage",
90-
blogPostComponent: "@theme/BlogPostPage",
91-
},
97+
blog: false,
9298
theme: {
9399
customCss: "./src/css/custom.css",
94100
},

plugins/blog-plugin.js

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
const blogPluginExports = require("@docusaurus/plugin-content-blog");
2+
3+
const defaultBlogPlugin = blogPluginExports.default;
4+
5+
async function blogPluginExtended(...pluginOptions) {
6+
const blogPluginInstance = await defaultBlogPlugin(...pluginOptions);
7+
8+
return {
9+
// Add all properties of the default blog plugin so existing functionality is preserved
10+
...blogPluginInstance,
11+
/**
12+
* Override the default `contentLoaded` hook to access blog posts data
13+
*/
14+
contentLoaded: async function (data) {
15+
const { content, actions } = data;
16+
17+
const allBlogPosts = content.blogPosts;
18+
19+
async function createRecentPostModule(blogPost, index) {
20+
return {
21+
// Inject the metadata you need for each recent blog post
22+
metadata: await actions.createData(
23+
`blogpost-metadata-${index}.json`,
24+
JSON.stringify({
25+
title: blogPost.metadata.title,
26+
description: blogPost.metadata.description,
27+
frontMatter: blogPost.metadata.frontMatter,
28+
image: blogPost.metadata.frontMatter.image,
29+
link: blogPost.metadata.permalink,
30+
date: blogPost.metadata.date,
31+
}),
32+
),
33+
34+
// Inject the MDX excerpt as a JSX component prop
35+
// (what's above the <!-- truncate --> marker)
36+
Preview: {
37+
__import: true,
38+
// The markdown file for the blog post will be loaded by webpack
39+
path: blogPost.metadata.source,
40+
query: {
41+
truncated: true,
42+
},
43+
},
44+
};
45+
}
46+
47+
// Create the gallery page
48+
data.actions.addRoute({
49+
// Add route for the home page
50+
path: "/home",
51+
exact: true,
52+
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
56+
modules: {
57+
blogPosts: await Promise.all(
58+
allBlogPosts.map(createRecentPostModule),
59+
),
60+
},
61+
});
62+
63+
// Call the default overridden `contentLoaded` implementation
64+
return blogPluginInstance.contentLoaded(data);
65+
},
66+
};
67+
}
68+
69+
module.exports = {
70+
...blogPluginExports,
71+
default: blogPluginExtended,
72+
};

src/components/Home/Home.module.css

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.blogCard {
2+
display: grid;
3+
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
4+
grid-gap: 1rem;
5+
}
6+
7+
.card {
8+
/* border: 2px solid #e7e7e7; */
9+
10+
/* border-radius: 4px; */
11+
12+
padding: 0.5rem;
13+
}

src/components/Home/Home.tsx

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import React from "react";
2+
import styles from "./Home.module.css";
3+
import Layout from "@theme/Layout";
4+
import { Content } from "@theme/BlogPostPage";
5+
import clsx from "clsx";
6+
7+
interface HomeProps {
8+
readonly blogPosts: readonly { readonly Preview: Content; metadata: any }[];
9+
}
10+
11+
function Home({ blogPosts }: HomeProps): JSX.Element {
12+
return (
13+
<Layout>
14+
<div className="container margin-top--lg margin-bottom--lg">
15+
<div className="row">
16+
<div className="col col--3 col--offset-1 ">
17+
<h1>Featured Posts</h1>
18+
</div>
19+
</div>
20+
<div className="row">
21+
{blogPosts.map(({ metadata }, index) => (
22+
<HomeCard
23+
key={`${metadata.date}-${index}-home`}
24+
index={index}
25+
metadata={metadata}
26+
context={"home"}
27+
/>
28+
))}
29+
</div>
30+
</div>
31+
</Layout>
32+
);
33+
}
34+
35+
export default Home;
36+
37+
export function HomeCard({ index, metadata, context }): JSX.Element {
38+
return (
39+
<div className={`${clsx("col col--3 col--offset-1")} ${styles.card}`}>
40+
<div className="text--center">
41+
<img src={metadata.image} alt={metadata.title} width="100" />
42+
</div>
43+
<div className="text--center padding-horiz--md">
44+
<h3>{metadata.title}</h3>
45+
<p>{metadata.description}</p>
46+
<a href={metadata.link} target="_blank" rel="noopener noreferrer">
47+
Read more
48+
</a>
49+
</div>
50+
</div>
51+
);
52+
}
Loading

0 commit comments

Comments
 (0)