this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

prefetch pages + add footer + revalidate

+55 -29
+4 -28
src/app/page.tsx
··· 1 - import { siBluesky as BlueskyIcon, siGithub as GithubIcon } from "simple-icons"; 2 - 1 + import { Footer } from "#/components/footer"; 3 2 import { PostList } from "#/components/post-list"; 4 3 import { Title } from "#/components/typography"; 5 - import { MY_DID } from "#/lib/bsky"; 6 4 7 - export const dynamic = "force-static"; 5 + export const dynamic = 'force-static' 6 + export const revalidate = 60 * 60; // 1 hour 8 7 9 8 export default function Home() { 10 9 return ( ··· 21 20 <PostList /> 22 21 </div> 23 22 </main> 24 - <footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> 25 - <a 26 - className="flex items-center gap-2 hover:underline hover:underline-offset-4" 27 - href={`https://bsky.app/profile/${MY_DID}`} 28 - target="_blank" 29 - rel="noopener noreferrer" 30 - > 31 - <svg width={16} height={16} viewBox="0 0 24 24"> 32 - <path d={BlueskyIcon.path} /> 33 - </svg> 34 - Bluesky 35 - </a> 36 - <a 37 - className="flex items-center gap-2 hover:underline hover:underline-offset-4" 38 - href="https://github.com/mozzius" 39 - target="_blank" 40 - rel="noopener noreferrer" 41 - > 42 - <svg width={16} height={16} viewBox="0 0 24 24"> 43 - <path d={GithubIcon.path} /> 44 - </svg> 45 - Github 46 - </a> 47 - </footer> 23 + <Footer /> 48 24 </div> 49 25 ); 50 26 }
+18
src/app/post/[rkey]/page.tsx
··· 7 7 import { Code as SyntaxHighlighter } from "bright"; 8 8 import rehypeSanitize from "rehype-sanitize"; 9 9 10 + import { Footer } from "#/components/footer"; 10 11 import { PostInfo } from "#/components/post-info"; 11 12 import { Code, Paragraph, Title } from "#/components/typography"; 12 13 import { bsky, MY_DID } from "#/lib/bsky"; 13 14 14 15 export const dynamic = "force-static"; 16 + export const revalidate = 60 * 60; // 1 hour 15 17 16 18 export async function generateMetadata({ 17 19 params, ··· 148 150 </Markdown> 149 151 </article> 150 152 </main> 153 + <Footer /> 151 154 </div> 152 155 ); 153 156 } 157 + 158 + // prefetch at build time 159 + export async function generateStaticParams() { 160 + const posts = await bsky.get("com.atproto.repo.listRecords", { 161 + params: { 162 + repo: MY_DID, 163 + collection: "com.whtwnd.blog.entry", 164 + // todo: pagination 165 + }, 166 + }); 167 + 168 + return posts.data.records.map((post) => ({ 169 + rkey: post.uri.split("/").pop(), 170 + })); 171 + }
+32
src/components/footer.tsx
··· 1 + import { siBluesky as BlueskyIcon, siGithub as GithubIcon } from "simple-icons"; 2 + 3 + import { MY_DID } from "#/lib/bsky"; 4 + 5 + export function Footer() { 6 + return ( 7 + <footer className="row-start-3 flex gap-6 flex-wrap items-center justify-center"> 8 + <a 9 + className="flex items-center gap-2 hover:underline hover:underline-offset-4" 10 + href={`https://bsky.app/profile/${MY_DID}`} 11 + target="_blank" 12 + rel="noopener noreferrer" 13 + > 14 + <svg width={16} height={16} viewBox="0 0 24 24"> 15 + <path d={BlueskyIcon.path} /> 16 + </svg> 17 + Bluesky 18 + </a> 19 + <a 20 + className="flex items-center gap-2 hover:underline hover:underline-offset-4" 21 + href="https://github.com/mozzius" 22 + target="_blank" 23 + rel="noopener noreferrer" 24 + > 25 + <svg width={16} height={16} viewBox="0 0 24 24"> 26 + <path d={GithubIcon.path} /> 27 + </svg> 28 + Github 29 + </a> 30 + </footer> 31 + ); 32 + }
+1 -1
src/components/post-list.tsx
··· 4 4 import { bsky, MY_DID } from "#/lib/bsky"; 5 5 6 6 import { PostInfo } from "./post-info"; 7 - import { Paragraph, Title } from "./typography"; 7 + import { Title } from "./typography"; 8 8 9 9 export async function PostList() { 10 10 const posts = await bsky.get("com.atproto.repo.listRecords", {