@@ -27,8 +27,8 @@ import crypto from 'node:crypto'
2727async function fetchBlueskyAvatars (
2828 imagesDir : string ,
2929 handles : string [ ] ,
30- ) : Promise < Map < string , string > > {
31- const avatarMap = new Map < string , string > ( )
30+ ) : Promise < Map < string , { localPath : string ; remotePath : string } > > {
31+ const avatarMap = new Map < string , { localPath : string ; remotePath : string } > ( )
3232 if ( handles . length === 0 ) return avatarMap
3333
3434 try {
@@ -58,7 +58,10 @@ async function fetchBlueskyAvatars(
5858 await writeFile ( join ( imagesDir , `${ hash } .jpg` ) , res . body ! )
5959 }
6060
61- avatarMap . set ( profile . handle , `/blog/avatar/${ hash } .jpg` )
61+ avatarMap . set ( profile . handle , {
62+ localPath : `/blog/avatar/${ hash } .jpg` ,
63+ remotePath : profile . avatar ,
64+ } )
6265 }
6366 }
6467 } catch ( error ) {
@@ -71,10 +74,16 @@ async function fetchBlueskyAvatars(
7174/**
7275 * Resolves authors with their Bluesky avatars and profile URLs.
7376 */
74- function resolveAuthors ( authors : Author [ ] , avatarMap : Map < string , string > ) : ResolvedAuthor [ ] {
77+ function resolveAuthors (
78+ authors : Author [ ] ,
79+ avatarMap : Map < string , { localPath : string ; remotePath : string } > ,
80+ ) : ResolvedAuthor [ ] {
7581 return authors . map ( author => ( {
7682 ...author ,
77- avatar : author . blueskyHandle ? ( avatarMap . get ( author . blueskyHandle ) ?? null ) : null ,
83+ avatar : author . blueskyHandle ? ( avatarMap . get ( author . blueskyHandle ) ?. localPath ?? null ) : null ,
84+ origAvatar : author . blueskyHandle
85+ ? ( avatarMap . get ( author . blueskyHandle ) ?. remotePath ?? null )
86+ : null ,
7887 profileUrl : author . blueskyHandle ? `https://bsky.app/profile/${ author . blueskyHandle } ` : null ,
7988 } ) )
8089}
@@ -195,7 +204,6 @@ export default defineNuxtModule({
195204 } )
196205
197206 nuxt . options . alias [ '#blog/posts' ] = join ( nuxt . options . buildDir , 'blog/posts' )
198- nuxt . options . alias [ '/blog/avatar' ] = join ( nuxt . options . dir . public , 'blog/avatar' )
199207
200208 // Add X-Robots-Tag header for draft posts to prevent indexing
201209 for ( const post of allPosts ) {
0 commit comments