@@ -212,7 +212,7 @@ export async function GET(request: Request) {
212212 }
213213
214214 // Generate dynamic content based on parameters or fetched data
215- const displayTitle = title || pageData ?. title || `Page ${ pageId ?. substring ( 0 , 8 ) } ...` ;
215+ const displayTitle = title || pageData ?. title || 'Untitled Page' ;
216216 const displayAuthor = author || pageData ?. authorUsername || pageData ?. username || 'WeWrite User' ;
217217 const displayContent = content || pageData ?. content || '' ;
218218 const displaySponsorCount = sponsors ? parseInt ( sponsors ) : sponsorCount ;
@@ -229,7 +229,15 @@ export async function GET(request: Request) {
229229 . map ( node => {
230230 if ( node . children ) {
231231 return node . children
232- . map ( child => child . text || '' )
232+ . map ( child => {
233+ // Handle both text nodes and link nodes
234+ if ( child . text ) {
235+ return child . text ;
236+ } else if ( child . type === 'link' && child . children ) {
237+ return child . children . map ( linkChild => linkChild . text || '' ) . join ( '' ) ;
238+ }
239+ return '' ;
240+ } )
233241 . join ( '' )
234242 . trim ( ) ;
235243 }
@@ -245,7 +253,7 @@ export async function GET(request: Request) {
245253 }
246254
247255 // Truncate content for display
248- contentPreview = truncateText ( contentPreview , 200 ) ;
256+ contentPreview = truncateText ( contentPreview , 300 ) ;
249257
250258 console . log ( '🖼️ [OG] Generating image with data:' , {
251259 displayTitle : truncateText ( displayTitle , 50 ) ,
@@ -268,7 +276,7 @@ export async function GET(request: Request) {
268276 padding : '60px'
269277 } }
270278 >
271- { /* Header with WeWrite branding */ }
279+ { /* Header with sponsor count and WeWrite logo */ }
272280 < div
273281 style = { {
274282 display : 'flex' ,
@@ -277,16 +285,7 @@ export async function GET(request: Request) {
277285 marginBottom : '40px'
278286 } }
279287 >
280- < div
281- style = { {
282- fontSize : 32 ,
283- fontWeight : 'bold' ,
284- color : 'white'
285- } }
286- >
287- WeWrite
288- </ div >
289- { displaySponsorCount > 0 && (
288+ { displaySponsorCount > 0 ? (
290289 < div
291290 style = { {
292291 fontSize : 20 ,
@@ -299,7 +298,18 @@ export async function GET(request: Request) {
299298 >
300299 { displaySponsorCount } { displaySponsorCount === 1 ? 'sponsor' : 'sponsors' }
301300 </ div >
301+ ) : (
302+ < div > </ div >
302303 ) }
304+ < div
305+ style = { {
306+ fontSize : 32 ,
307+ fontWeight : 'bold' ,
308+ color : 'white'
309+ } }
310+ >
311+ WeWrite
312+ </ div >
303313 </ div >
304314
305315 { /* Main content area */ }
@@ -318,7 +328,7 @@ export async function GET(request: Request) {
318328 fontWeight : 'bold' ,
319329 color : 'white' ,
320330 lineHeight : 1.2 ,
321- marginBottom : '20px '
331+ marginBottom : '24px '
322332 } }
323333 >
324334 { truncateText ( displayTitle , 80 ) }
@@ -328,42 +338,23 @@ export async function GET(request: Request) {
328338 { contentPreview && (
329339 < div
330340 style = { {
331- fontSize : 24 ,
332- color : 'rgba(255, 255, 255, 0.7 )' ,
341+ fontSize : 28 ,
342+ color : 'rgba(255, 255, 255, 0.8 )' ,
333343 lineHeight : 1.4 ,
334- marginBottom : '30px '
344+ marginBottom : '32px '
335345 } }
336346 >
337347 { contentPreview }
338348 </ div >
339349 ) }
340350
341- { /* Author info */ }
351+ { /* Author info - no avatar */ }
342352 < div
343353 style = { {
344- display : 'flex' ,
345- alignItems : 'center' ,
346- fontSize : 20 ,
347- color : 'rgba(255, 255, 255, 0.8)'
354+ fontSize : 22 ,
355+ color : 'rgba(255, 255, 255, 0.7)'
348356 } }
349357 >
350- < div
351- style = { {
352- width : '40px' ,
353- height : '40px' ,
354- borderRadius : '50%' ,
355- background : 'linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%)' ,
356- display : 'flex' ,
357- alignItems : 'center' ,
358- justifyContent : 'center' ,
359- marginRight : '12px' ,
360- fontSize : '18px' ,
361- fontWeight : 'bold' ,
362- color : 'white'
363- } }
364- >
365- { displayAuthor . charAt ( 0 ) . toUpperCase ( ) }
366- </ div >
367358 by { displayAuthor }
368359 </ div >
369360 </ div >
@@ -387,12 +378,13 @@ export async function GET(request: Request) {
387378 </ div >
388379 < div
389380 style = { {
390- fontSize : 20 ,
381+ fontSize : 32 ,
391382 fontWeight : 'bold' ,
392383 color : 'white' ,
393- padding : '12px 24px' ,
394- borderRadius : '25px' ,
395- background : 'linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%)'
384+ padding : '20px 48px' ,
385+ borderRadius : '50px' ,
386+ background : 'linear-gradient(135deg, #3B82F6 0%, #1D4ED8 100%)' ,
387+ boxShadow : '0 8px 32px rgba(59, 130, 246, 0.3)'
396388 } }
397389 >
398390 Read & Support →
0 commit comments