Skip to content

Commit 1e6db6b

Browse files
committed
fix: Always include page.tags
Fixes #1237
1 parent 9531885 commit 1e6db6b

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/document.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ fn document_attributes(
330330
.map(Value::scalar)
331331
.collect(),
332332
);
333+
let tags = Value::Array(front.tags.iter().cloned().map(Value::scalar).collect());
333334
// Reason for `file`:
334335
// - Allow access to assets in the original location
335336
// - Ease linking back to page's source
@@ -360,6 +361,7 @@ fn document_attributes(
360361
Value::scalar(front.description.as_deref().unwrap_or("").to_owned()),
361362
),
362363
("categories".into(), categories),
364+
("tags".into(), tags),
363365
("is_draft".into(), Value::scalar(front.is_draft)),
364366
("weight".into(), Value::scalar(front.weight)),
365367
("file".into(), Value::Object(file)),
@@ -368,11 +370,6 @@ fn document_attributes(
368370
];
369371
let mut attributes: Object = attributes.into_iter().collect();
370372

371-
if !front.tags.is_empty() {
372-
let tags = Value::Array(front.tags.iter().cloned().map(Value::scalar).collect());
373-
attributes.insert("tags".into(), tags);
374-
}
375-
376373
if let Some(ref published_date) = front.published_date {
377374
attributes.insert("published_date".into(), Value::scalar(*published_date));
378375
}

0 commit comments

Comments
 (0)