@@ -6,6 +6,23 @@ import { Footer } from '~/components/Footer'
6
6
import { RSSIcon } from '~/components/icons'
7
7
import { memo } from 'react'
8
8
9
+ export const links : Route . LinksFunction = ( ) => [
10
+ {
11
+ rel : 'preload' ,
12
+ href : '/fonts/Inter_18pt-Regular.woff2' ,
13
+ as : 'font' ,
14
+ type : 'font/woff2' ,
15
+ crossOrigin : 'anonymous' ,
16
+ } ,
17
+ {
18
+ rel : 'preload' ,
19
+ href : '/fonts/Inter_18pt-Bold.woff2' ,
20
+ as : 'font' ,
21
+ type : 'font/woff2' ,
22
+ crossOrigin : 'anonymous' ,
23
+ } ,
24
+ ]
25
+
9
26
export function meta ( _args : Route . MetaArgs ) {
10
27
const url = 'https://mawburn.com/blog'
11
28
const description =
@@ -36,56 +53,53 @@ export function meta(_args: Route.MetaArgs) {
36
53
export function loader ( ) {
37
54
const posts = getAllPostsMetadata ( )
38
55
39
- return new Response ( JSON . stringify ( { posts } ) , {
40
- headers : {
41
- 'Content-Type' : 'application/json' ,
42
- 'Cache-Control' : 'public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400' ,
43
- 'CDN-Cache-Control' : 'max-age=86400' ,
44
- 'Cloudflare-CDN-Cache-Control' : 'max-age=86400' ,
45
- ETag : `"blog-list-${ posts . length } "` ,
46
- Vary : 'Accept-Encoding' ,
47
- } ,
48
- } )
56
+ return {
57
+ posts,
58
+ }
49
59
}
50
60
51
- const BlogPostCard = memo ( ( { post } : { post : BlogPostMetadata } ) => {
52
- const formattedDate = new Date ( post . date ) . toLocaleDateString ( 'en-US' , {
53
- year : 'numeric' ,
54
- month : 'long' ,
55
- day : 'numeric' ,
56
- } )
61
+ export function headers ( ) {
62
+ return {
63
+ 'Cache-Control' : 'public, max-age=3600, s-maxage=86400, stale-while-revalidate=86400' ,
64
+ 'CDN-Cache-Control' : 'max-age=86400' ,
65
+ 'Cloudflare-CDN-Cache-Control' : 'max-age=86400' ,
66
+ Vary : 'Accept-Encoding' ,
67
+ }
68
+ }
57
69
58
- return (
59
- < article
60
- key = { post . slug }
61
- className = "border-b border-gray-200 dark:border-gray-700 pb-8 mb-8 last:mb-0"
70
+ const BlogPostCard = memo ( ( { post } : { post : BlogPostMetadata } ) => (
71
+ < article className = "border-b border-gray-200 dark:border-gray-700 pb-8 mb-8 last:mb-0" >
72
+ < Link
73
+ to = { `/blog/${ post . slug } ` }
74
+ className = "block hover:bg-gray-50 dark:hover:bg-gray-800 rounded-lg p-4 -m-4 transition-colors"
75
+ prefetch = "intent"
62
76
>
63
- < Link
64
- to = { `/blog/ ${ post . slug } ` }
65
- className = "block hover:bg-gray-50 dark:hover:bg-gray-800 rounded-lg p-4 -m-4 transition-colors"
66
- prefetch = "intent"
67
- >
68
- < h2 className = "text-2xl font-semibold text-gray-900 dark:text-white mb-2 hover:text-fuchsia-600 dark:hover:text-fuchsia-400 transition-colors" >
69
- { post . title }
70
- </ h2 >
71
- < div className = "flex items-center text-sm text-gray-700 dark:text-gray-200 mb-3 space-x-2" >
72
- < time dateTime = { post . date } > { formattedDate } </ time >
73
- < span > • </ span >
74
- < span > { post . readTime } min read </ span >
75
- </ div >
76
- < p className = "text-gray-600 dark:text-gray-300 mb-3" > { post . excerpt } </ p >
77
- < div className = "flex flex-wrap gap-2" >
78
- < span className = "inline-block font-bold text-gray-700 dark:text-gray-200 text-xs whitespace-nowrap " >
79
- Tags:
80
- </ span > { ' ' }
81
- < span className = "inline-block text-gray-700 dark:text-gray-400 text-xs whitespace-nowrap" >
82
- { post . tags . join ( ', ' ) }
83
- </ span >
84
- </ div >
85
- </ Link >
86
- </ article >
87
- )
88
- } )
77
+ < h2 className = "text-2xl font-semibold text-gray-900 dark:text-white mb-2 hover:text-fuchsia-600 dark:hover:text-fuchsia-400 transition-colors" >
78
+ { post . title }
79
+ </ h2 >
80
+ < div className = "flex items-center text-sm text-gray-700 dark:text-gray-200 mb-3 space-x-2" >
81
+ < time dateTime = { post . date } >
82
+ { new Date ( post . date ) . toLocaleDateString ( 'en-US' , {
83
+ year : 'numeric' ,
84
+ month : 'long' ,
85
+ day : 'numeric' ,
86
+ } ) }
87
+ </ time >
88
+ < span > • </ span >
89
+ < span > { post . readTime } min read </ span >
90
+ </ div >
91
+ < p className = "text-gray-600 dark:text-gray-300 mb-3" > { post . excerpt } </ p >
92
+ < div className = "flex flex-wrap gap-2 " >
93
+ < span className = "inline-block font-bold text-gray-700 dark:text-gray-200 text-xs whitespace-nowrap" >
94
+ Tags:
95
+ </ span > { ' ' }
96
+ < span className = "inline-block text-gray-700 dark:text-gray-400 text-xs whitespace-nowrap" >
97
+ { post . tags . join ( ', ' ) }
98
+ </ span >
99
+ </ div >
100
+ </ Link >
101
+ </ article >
102
+ ) )
89
103
90
104
BlogPostCard . displayName = 'BlogPostCard'
91
105
0 commit comments