diff --git a/app/blog/[slug]/page.tsx b/app/blog/[slug]/page.tsx index 5ca6059..733df4e 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[slug]/page.tsx @@ -1,6 +1,8 @@ +import fs from 'fs' import { getPostData } from '@/lib/posts' import formatDate from '@/lib/format' import Link from 'next/link' +import path from 'path' type Params = { slug: string @@ -57,6 +59,17 @@ export async function generateMetadata({ params }: Props) { } } +export function generateStaticParams() { + const postsDirectory = path.join(process.cwd(), 'posts'); + const fileNames = fs.readdirSync(postsDirectory) + return fileNames.map((fileName) => { + return { + slug: path.basename(fileName, '.md') + } + }); +} + + // -< Post >- export default async function Post({ params }: Props) { const postData: PostData = await getPostData(params.slug); diff --git a/app/get-demo/page.tsx b/app/get-demo/page.tsx index 04187ba..8b04a64 100644 --- a/app/get-demo/page.tsx +++ b/app/get-demo/page.tsx @@ -4,9 +4,13 @@ import Footer from "@/components/footer"; import Navbar from "@/components/navbar"; import { Work_Sans } from "next/font/google"; import { useSearchParams, useRouter } from 'next/navigation' -import { companies } from "../page"; import Image from "next/image"; +const companies = [ + { file: 'companies/philippines.webp', name: 'Philippines chamber of commerce' }, + { file: 'companies/spd.webp', name: 'SPD Jobs inc' }, + { file: 'companies/cbrc.webp', name: 'CBRC' }, +]; const workSans = Work_Sans({ weight: ['400', '500', '600'], diff --git a/app/page.tsx b/app/page.tsx index 4768ea6..0958989 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -5,7 +5,7 @@ import Footer from '@/components/footer'; import Discover from '@/components/discover'; import Image from 'next/image'; -export const companies = [ +const companies = [ { file: 'companies/philippines.webp', name: 'Philippines chamber of commerce' }, { file: 'companies/spd.webp', name: 'SPD Jobs inc' }, { file: 'companies/cbrc.webp', name: 'CBRC' }, diff --git a/package-lock.json b/package-lock.json index 66c5fce..32f8f47 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,6 +22,7 @@ "remark-html": "^16.0.1" }, "devDependencies": { + "@types/luxon": "^3.4.0", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18", @@ -570,6 +571,12 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/luxon": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-3.4.0.tgz", + "integrity": "sha512-PEVoA4MOfSsFNaPrZjIUGUZujBDxnO/tj2A2N9KfzlR+pNgpBdDuk0TmRvSMAVUP5q4q8IkMEZ8UOp3MIr+QgA==", + "dev": true + }, "node_modules/@types/mdast": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/mdast/-/mdast-4.0.3.tgz", diff --git a/package.json b/package.json index 1013773..3b4269c 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "remark-html": "^16.0.1" }, "devDependencies": { + "@types/luxon": "^3.4.0", "@types/node": "^20", "@types/react": "^18", "@types/react-dom": "^18",