ReviewOS

also looking at this

stacks/postline

Long-form composer mode for the blog target

#10
Merged glennmichael123 wants to merge feat/blog-longform into main
7 files +33 -8
app/Services/Social/BlogService.tsmodified+8-4
Changes to app/Services/Social/BlogService.ts
@@ -58,7 +58,7 @@ export class BlogService {
5858
5959 async publishToPost(
6060 post: { id: number, body: string },
61 _content?: PublishContent,
61 content?: PublishContent,
6262 ): Promise<CrosspostTargetResult> {
6363 const targetUuid = uuid()
6464 const createdAt = now()
@@ -79,16 +79,20 @@ export class BlogService {
7979 .executeTakeFirstOrThrow()
8080
8181 try {
82 // Explicit title (long-form composer) keeps the whole text as body;
83 // otherwise the first line doubles as the title and is stripped.
84 const explicitTitle = content?.title?.trim()
8285 const lines = post.body.split('\n').map(line => line.trim())
83 const title = (lines.find(Boolean) || 'Untitled post').slice(0, 200)
86 const title = (explicitTitle || lines.find(Boolean) || 'Untitled post').slice(0, 200)
8487 const body = post.body.trim()
8588 const slug = await uniqueSlug(slugify(title))
8689 const accountId = await ensureAccount()
8790 const publishedAt = now()
8891
89 // Body minus the title line — the blog theme already renders the title.
9092 const firstContentIndex = post.body.split('\n').findIndex(line => line.trim())
91 const markdownBody = post.body.split('\n').slice(firstContentIndex + 1).join('\n').trim() || body
93 const markdownBody = explicitTitle
94 ? body
95 : post.body.split('\n').slice(firstContentIndex + 1).join('\n').trim() || body
9296
9397 await mkdir(CONTENT_DIR, { recursive: true })
9498 await Bun.write(join(CONTENT_DIR, `${slug}.md`), [