My personal site. theclashfruit.me
0
fork

Configure Feed

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

feat: seo stuff

+27 -33
-15
app/(main)/art/page.tsx
··· 1 - import type { Metadata } from 'next'; 2 - 3 - export const metadata: Metadata = { 4 - title: 'Art' 5 - }; 6 - 7 - export default function Art() { 8 - return ( 9 - <> 10 - <p>Art</p> 11 - 12 - <ul></ul> 13 - </> 14 - ); 15 - }
+2
app/(main)/layout.tsx
··· 37 37 href: '/blog', 38 38 text: 'Blog' 39 39 }, 40 + /* 40 41 { 41 42 icon: <LineSquiggle />, 42 43 href: '/art', ··· 47 48 href: '/photos', 48 49 text: 'Photos' 49 50 }, 51 + */ 50 52 { 51 53 icon: <GitPullRequestCreateArrow />, 52 54 href: '/projects',
-15
app/(main)/photos/page.tsx
··· 1 - import type { Metadata } from 'next'; 2 - 3 - export const metadata: Metadata = { 4 - title: 'Photos' 5 - }; 6 - 7 - export default function Photos() { 8 - return ( 9 - <> 10 - <p>Photos</p> 11 - 12 - <ul></ul> 13 - </> 14 - ); 15 - }
+25 -3
app/sitemap.ts
··· 1 1 import { spawn } from 'node:child_process'; 2 2 3 + import { db } from '@/lib/db/drizzle'; 4 + import { postsTable } from '@/lib/db/schema'; 5 + 6 + import { not, desc } from 'drizzle-orm'; 7 + 3 8 import type { MetadataRoute } from 'next'; 4 9 5 10 export default async function sitemap(): Promise<MetadataRoute.Sitemap> { 6 - // TODO: Get the dates for the stuff that is stored in the db. 7 - 11 + const posts = await db 12 + .select() 13 + .from(postsTable) 14 + .where(not(postsTable.draft)) 15 + .orderBy(desc(postsTable.publishedAt)); 16 + 8 17 return [ 9 18 { 10 19 url: 'https://theclashfruit.me', ··· 14 23 }, 15 24 { 16 25 url: 'https://theclashfruit.me/blog', 17 - lastModified: new Date(), 26 + lastModified: 27 + posts.length > 0 28 + ? posts[0].updatedAt 29 + : await getGitCommitDate('app/(main)/blog/page.tsx'), 18 30 changeFrequency: 'monthly', 19 31 priority: 0.8 20 32 }, 33 + ...(() => { 34 + return posts.map((p) => ({ 35 + url: `https://theclashfruit.me/post/${p.slug}`, 36 + lastModified: p.updatedAt, 37 + changeFrequency: 'monthly' as const, 38 + priority: 0.8 39 + })); 40 + })(), 41 + /* 21 42 { 22 43 url: 'https://theclashfruit.me/art', 23 44 lastModified: new Date(), ··· 30 51 changeFrequency: 'monthly', 31 52 priority: 0.8 32 53 }, 54 + */ 33 55 { 34 56 url: 'https://theclashfruit.me/projects', 35 57 lastModified: await getGitCommitDate('app/(main)/projects/page.tsx'),