trim title off body if detected

This commit is contained in:
2026-03-24 21:32:20 +00:00
parent 73bd05f650
commit 2048c576e9
+6 -1
View File
@@ -50,7 +50,7 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
} }
} }
const body = lines.slice(bodyStartLineIndex).join("\n") let body = lines.slice(bodyStartLineIndex).join("\n")
const filepath = fileURLToPath(fileUrl) const filepath = fileURLToPath(fileUrl)
const filename = filepath.slice(filepath.lastIndexOf("/") + 1) const filename = filepath.slice(filepath.lastIndexOf("/") + 1)
@@ -82,6 +82,11 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
?.slice(14), ?.slice(14),
) )
if (data["title"]) {
body.replace(`# ${data["title"]}\n`, '');
body = body.trim();
}
return { return {
data, data,
rawData: frontmatter, rawData: frontmatter,