import React from "react"; import { client } from "@/lib/sanity"; import { Metadata } from "next"; import BlogCards from "@/components/cards/BlogCards"; import { Rss } from "lucide-react"; import { Button } from "@/components/ui/button"; import Link from "next/link"; export const dynamic = "force-static"; export async function generateMetadata(props: { params: Promise<{ id: string }>; }): Promise { return { title: "Blog - SVR.JS", description: "Welcome to the SVR.JS Blog! Discover web development, security tips, and server admin insights. Stay updated with the latest SVR.JS news!", alternates: { canonical: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/blog/page/${(await props.params).id}` }, openGraph: { title: "Blog - SVR.JS", description: "Welcome to the SVR.JS Blog! Discover web development, security tips, and server admin insights. Stay updated with the latest SVR.JS news!", url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/blog/page/${(await props.params).id}`, type: "website", images: [ { url: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/metadata/svrjs-cover.png`, width: 800, height: 600, alt: "Blog - SVR.JS" } ] }, twitter: { card: "summary_large_image", site: "@SVR_JS", title: "Blog - SVR.JS", description: "Welcome to the SVR.JS Blog! Discover web development, security tips, and server admin insights. Stay updated with the latest SVR.JS news!", images: [ `${process.env.NEXT_PUBLIC_WEBSITE_URL}/metadata/svrjs-cover.png` ], creator: "@SVR_JS" } }; } const BlogPage = async (props: { params: Promise<{ id: string }> }) => { const params = await props.params; // Optionally, you can fetch some initial data here if needed. let id = parseInt(params.id); if (isNaN(id)) id = 1; return (

SVR.JS Blog

Our blog has web development, web server administration, and web application security tips.

); }; export async function generateStaticParams() { // Change in BlogCards component and in /api/revalidate route too! const cardsPerPage = 6; const totalPostsQuery = `count(*[_type == 'blog'])`; const totalPosts: number = await client.fetch( totalPostsQuery, {}, { cache: "no-store" } ); const totalPages = Math.ceil(totalPosts / cardsPerPage); let ids: any[] = []; for (let i = 1; i <= totalPages; i++) { ids.push({ id: i.toString() }); } return ids; } export default BlogPage;