summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/index.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/index.ts b/src/index.ts
index 85e57db..48c140a 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -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 filename = filepath.slice(filepath.lastIndexOf("/") + 1)
@@ -82,6 +82,11 @@ export default function gemtext(config: GemtextConfig = {}): AstroIntegration {
?.slice(14),
)
+ if (data["title"]) {
+ body.replace(`# ${data["title"]}\n`, '');
+ body = body.trim();
+ }
+
return {
data,
rawData: frontmatter,