Skip to content

Commit

Permalink
feat: add blog on nestjs aws s3
Browse files Browse the repository at this point in the history
  • Loading branch information
adarshaacharya committed May 4, 2024
1 parent ea3efdd commit da02179
Show file tree
Hide file tree
Showing 13 changed files with 522 additions and 4 deletions.
4 changes: 4 additions & 0 deletions contentlayer.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ export const Blog = defineDocumentType(() => ({
image: {
type: "string",
},
draft: {
type: "boolean",
default: false,
},
},
computedFields,
}));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/_static/blogs/aws-s3-nestjs/thumbnail.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { allBlogs } from "contentlayer/generated";
import { Metadata } from "next";
import { generatePageMetadata } from "../seo";
import Link from "next/link";
import { ENV } from "@/lib/env";

export const metadata = generatePageMetadata({
title: "Blog",
description: "Read my blogs on web development, design and more.",
});

const isProd = ENV.NODE_ENV === "production";

export default function Blog() {
const blogs = allBlogs.sort((a, b) => {
if (new Date(a.publishedAt) > new Date(b.publishedAt)) {
Expand All @@ -17,10 +20,12 @@ export default function Blog() {
return 1;
});

const undraftedBlogs = isProd ? blogs.filter((blog) => !blog.draft) : blogs;

return (
<section>
<ul>
{blogs.map((blog) => (
{undraftedBlogs.map((blog) => (
<li
key={blog.slug}
className="py-1 divide-y divide-gray-200 dark:divide-gray-700"
Expand Down
1 change: 0 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "./global.css";
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import { cn } from "@/lib/utils";
import { ThemeProvider } from "@/components/theme-provider";
import { Header } from "@/components/header";
Expand Down
Loading

0 comments on commit da02179

Please sign in to comment.