Added full SSG/Static support
This commit is contained in:
parent
b1de88f998
commit
1f6b769ea4
3 changed files with 17 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { metadata } from '@/app/metadata'
|
||||
import { getCategoryBySlug, getPostsByCategory } from '@/lib/categories'
|
||||
import { getAllCategories, getCategoryBySlug, getPostsByCategory } from '@/lib/categories'
|
||||
import type { Metadata } from 'next'
|
||||
import Link from 'next/link'
|
||||
|
||||
|
|
@ -9,6 +9,13 @@ type CategoryPageProps = {
|
|||
}>
|
||||
}
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const categories = getAllCategories()
|
||||
return Object.keys(categories).map((category) => ({
|
||||
categorySlug: category,
|
||||
}))
|
||||
}
|
||||
|
||||
export async function generateMetadata({ params }: CategoryPageProps): Promise<Metadata> {
|
||||
const { categorySlug } = await params
|
||||
const category = getCategoryBySlug(categorySlug)
|
||||
|
|
|
|||
|
|
@ -6,6 +6,13 @@ import Link from 'next/link'
|
|||
import { metadata } from '@/app/metadata'
|
||||
import { dateFormatter } from '@/utils/time'
|
||||
|
||||
export async function generateStaticParams() {
|
||||
const categories = getAllCategories()
|
||||
return Object.keys(categories).map((category) => ({
|
||||
categorySlug: category,
|
||||
}))
|
||||
}
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
return {
|
||||
title: `Categories | ${metadata.title!.toString()}`,
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
import { metadata } from '@/app/metadata'
|
||||
import { getAllPostsMeta } from '@/lib/posts'
|
||||
|
||||
export const dynamic = "force-static"
|
||||
|
||||
const SITE_URL = process.env.SITE_URL || 'http://localhost:3000'
|
||||
|
||||
function escapeXml(str: string) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue