fix: don't add inline uploaded images as photo property

Inline images embedded in the note body were being uploaded and then
also added as Micropub `photo` properties, causing posts to be
classified as photo posts instead of articles/notes.

Inline images are already present in the `content` HTML after upload —
only explicitly declared `photo` frontmatter should set the photo property.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
svemagie
2026-03-23 20:13:02 +01:00
parent 0623c3ad0b
commit 0ae627fb52
2 changed files with 9 additions and 9 deletions
+4 -4
View File
File diff suppressed because one or more lines are too long
+5 -5
View File
@@ -119,7 +119,7 @@ export class Publisher {
// postType: article → always publishes as article (sets `name`) // postType: article → always publishes as article (sets `name`)
// postType: note → always publishes as note (skips `name`) // postType: note → always publishes as note (skips `name`)
// (absent) → auto-detect: has title → article, otherwise → note // (absent) → auto-detect: has title → article, otherwise → note
const postType = fm["postType"] ?? fm["post-type"] ?? fm["type"]; const postType = fm["postType"] ?? fm["posttype"] ?? fm["post-type"] ?? fm["type"];
const isArticle = const isArticle =
postType === "article" || postType === "article" ||
(!postType && Boolean(fm["title"] ?? fm["name"])); (!postType && Boolean(fm["title"] ?? fm["name"]));
@@ -209,13 +209,13 @@ export class Publisher {
if (aiTools != null) props["ai-tools"] = [String(aiTools)]; if (aiTools != null) props["ai-tools"] = [String(aiTools)];
if (aiDescription != null) props["ai-description"] = [String(aiDescription)]; if (aiDescription != null) props["ai-description"] = [String(aiDescription)];
// Photos: prefer structured photo array from frontmatter (with alt text), // Photos: only use explicitly declared photo frontmatter (with alt text).
// fall back to uploaded local images. // Inline images uploaded from the body are already embedded in `content`
// and must NOT be added as `photo` — doing so would make Micropub treat
// the post as a photo post instead of an article/note.
const fmPhotos = this.resolvePhotoArray(fm["photo"]); const fmPhotos = this.resolvePhotoArray(fm["photo"]);
if (fmPhotos.length > 0) { if (fmPhotos.length > 0) {
props["photo"] = fmPhotos; props["photo"] = fmPhotos;
} else if (uploadedUrls.length > 0) {
props["photo"] = uploadedUrls.map((url) => ({ value: url }));
} }
// Related posts — resolve [[WikiLink]] wikilinks to published blog URLs // Related posts — resolve [[WikiLink]] wikilinks to published blog URLs