A CLI for publishing standard.site documents to ATProto sequoia.pub
standard site lexicon cli publishing

fix: asset subdirectories

+21 -2
+21 -2
packages/cli/src/lib/atproto.ts
··· 190 190 contentDir: string, 191 191 ): Promise<string | null> { 192 192 // Try multiple resolution strategies 193 - const filename = path.basename(ogImage); 194 193 195 194 // 1. If imagesDir is specified, look there 196 195 if (imagesDir) { 197 - const imagePath = path.join(imagesDir, filename); 196 + // Get the base name of the images directory (e.g., "blog-images" from "public/blog-images") 197 + const imagesDirBaseName = path.basename(imagesDir); 198 + 199 + // Check if ogImage contains the images directory name and extract the relative path 200 + // e.g., "/blog-images/other/file.png" with imagesDirBaseName "blog-images" -> "other/file.png" 201 + const imagesDirIndex = ogImage.indexOf(imagesDirBaseName); 202 + let relativePath: string; 203 + 204 + if (imagesDirIndex !== -1) { 205 + // Extract everything after "blog-images/" 206 + const afterImagesDir = ogImage.substring( 207 + imagesDirIndex + imagesDirBaseName.length, 208 + ); 209 + // Remove leading slash if present 210 + relativePath = afterImagesDir.replace(/^[/\\]/, ""); 211 + } else { 212 + // Fall back to just the filename 213 + relativePath = path.basename(ogImage); 214 + } 215 + 216 + const imagePath = path.join(imagesDir, relativePath); 198 217 if (await fileExists(imagePath)) { 199 218 const stat = await fs.stat(imagePath); 200 219 if (stat.size > 0) {