Skip to content

Commit

Permalink
feat(blog): partial integrade blog pages with Velite
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Feb 24, 2024
1 parent 5b9b4f6 commit ddee863
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/app/blog/categories/[category]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import type { Metadata } from 'next'
import { FolderOpen } from '@phosphor-icons/react/dist/ssr'

import { PostList } from '~/components/post-list'

Expand All @@ -8,9 +9,7 @@ import {
getPostListOfCategory,
getNormalCategoryString
} from '~/lib/categories'
import { getSortedPosts } from '~/lib/get-sorted-posts'
import { slug } from '~/lib/slug'
import { FolderOpen } from '@phosphor-icons/react/dist/ssr'

interface Props {
params: { category: string }
Expand All @@ -28,7 +27,7 @@ export function generateMetadata({ params }: Props): Metadata {
export default function Page({ params }: Props) {
const { category } = params

const postList = getSortedPosts(getPostListOfCategory(slug(category)))
const postList = getPostListOfCategory(slug(category))

return (
<div className="content-container m-auto">
Expand Down
4 changes: 2 additions & 2 deletions src/app/blog/categories/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import type { Metadata } from 'next'
import Link from 'next/link'
import { Folder } from '@phosphor-icons/react/dist/ssr'

import { getCategoriesAndNumberOfPosts } from '~/lib/categories'
import { slug } from '~/lib/slug'
import { Folder } from '@phosphor-icons/react/dist/ssr'
import { getCategoriesAndNumberOfPosts } from '~/lib/categories'

export const metadata: Metadata = {
title: 'Blog Categories',
Expand Down
6 changes: 3 additions & 3 deletions src/app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Link, { LinkProps } from 'next/link'
import { Icon as PhosphorIcon } from '@phosphor-icons/react'
import { FolderOpen, Tag, Notebook } from '@phosphor-icons/react/dist/ssr'

import { allPosts } from 'contentlayer/generated'
import { getSortedPosts } from '~/lib/get-sorted-posts'

import { PostList } from '~/components/post-list'
import { Title } from '~/components/title'
import { posts } from '#content'

export const metadata: Metadata = {
title: 'Blog',
Expand Down Expand Up @@ -40,7 +40,7 @@ const TopLink = ({ Icon, title, ...rest }: TopLinkProps) => (
)

export default function Page() {
const posts = getSortedPosts(allPosts)
const sortedPosts = getSortedPosts(posts)

return (
<div className="content-container m-auto">
Expand All @@ -50,7 +50,7 @@ export default function Page() {
<TopLink Icon={Tag} href="/blog/tag" title="Tags" />
<TopLink Icon={Notebook} href="/blog/til" title="T.I.L" />
</div>
<PostList posts={posts} separateByYear />
<PostList posts={sortedPosts} separateByYear />
</div>
)
}
2 changes: 1 addition & 1 deletion src/app/blog/tag/[tag]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react'
import type { Metadata } from 'next'
import { Tag } from '@phosphor-icons/react/dist/ssr'

import { PostList } from '~/components/post-list'

Expand All @@ -9,7 +10,6 @@ import {
getNormalTagString
} from '~/lib/tags'
import { getSortedPosts } from '~/lib/get-sorted-posts'
import { Tag } from '@phosphor-icons/react/dist/ssr'
import { slug } from '~/lib/slug'

interface Props {
Expand Down
2 changes: 1 addition & 1 deletion src/app/blog/tag/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import type { Metadata } from 'next'
import Link from 'next/link'
import { Tag } from '@phosphor-icons/react/dist/ssr'

import { slug } from '~/lib/slug'
import { getTagsAndNumberOfPosts } from '~/lib/tags'
import { Tag } from '@phosphor-icons/react/dist/ssr'

export const metadata: Metadata = {
title: 'Blog Tags',
Expand Down

0 comments on commit ddee863

Please sign in to comment.