File tree Expand file tree Collapse file tree 2 files changed +37
-16
lines changed
Expand file tree Collapse file tree 2 files changed +37
-16
lines changed Original file line number Diff line number Diff line change @@ -66,16 +66,33 @@ const ogImage = new URL(i18n.coverImage.src, site).href;
6666 <p class =" md:flex-1/2 text-xl max-w-[40ch]" >{ i18n .summary } </p >
6767
6868 {
69- i18n .author || i18n .lastUpdatedAt || i18n .createdAt ? (
70- <p class = " text-black" >
71- { i18n .author ? ` Written by ${i18n .author }. ` : null }
72- { i18n .lastUpdatedAt
73- ? ` ${i18n .lastUpdatedAt .toLocaleDateString (" en-US" , { month: " short" , day: " numeric" , year: " numeric" })} `
69+ (i18n .author || i18n .lastUpdatedAt || i18n .createdAt ) && (
70+ <div class = " flex flex-wrap items-center gap-2 text-sm text-gray-700" >
71+ { i18n .author && (
72+ <span class = " font-medium" >{ ` Written by ${i18n .author } ` } </span >
73+ )}
74+ { (i18n .lastUpdatedAt || i18n .createdAt ) && (
75+ <>
76+ <span class = " mx-1 text-gray-400" >•</span >
77+ <span >
78+ { (i18n .lastUpdatedAt
79+ ? i18n .lastUpdatedAt
7480 : i18n .createdAt
75- ? ` ${i18n .createdAt .toLocaleDateString (" en-US" , { month: " short" , day: " numeric" , year: " numeric" })} `
76- : null }
77- </p >
78- ) : null
81+ )
82+ ? (i18n .lastUpdatedAt
83+ ? i18n .lastUpdatedAt
84+ : i18n .createdAt
85+ )?.toLocaleDateString (" en-US" , {
86+ month: " short" ,
87+ day: " numeric" ,
88+ year: " numeric" ,
89+ })
90+ : " " }
91+ </span >
92+ </>
93+ )}
94+ </div >
95+ )
7996 }
8097
8198 <div class =" flex flex-row gap-2" >
Original file line number Diff line number Diff line change @@ -11,13 +11,17 @@ export async function GET(context) {
1111 description :
1212 "Sell more and answer every question with Conversational Discovery. Trieve uses GenAI to show your users what they're looking for every time" ,
1313 site : context . site ,
14- items : blog . map ( ( post ) => ( {
15- link : `/blog/${ post . id } /` ,
16- content : sanitizeHtml ( parser . render ( post . body ) , {
17- allowedTags : sanitizeHtml . defaults . allowedTags . concat ( [ "img" ] ) ,
18- } ) ,
19- ...post . data ,
20- } ) ) ,
14+ items : blog
15+ . filter ( ( post ) => ! ( post . data . isDraft ?? false ) )
16+ . sort ( ( a , b ) => new Date ( b . data . date ) - new Date ( a . data . date ) )
17+ . map ( ( post ) => ( {
18+ link : `/blog/${ post . id } /` ,
19+ content : sanitizeHtml ( parser . render ( post . body ) , {
20+ allowedTags : sanitizeHtml . defaults . allowedTags . concat ( [ "img" ] ) ,
21+ } ) ,
22+ pubDate : post . data . lastUpdatedAt ,
23+ ...post . data ,
24+ } ) ) ,
2125 customData : `<language>en-us</language>` ,
2226 } ) ;
2327}
You can’t perform that action at this time.
0 commit comments