Skip to content

Commit

Permalink
Add path to source to layout rendering context
Browse files Browse the repository at this point in the history
  • Loading branch information
alterae committed Nov 18, 2022
1 parent 4063ebd commit b9e61df
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/site.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,21 @@ impl Site {
"NOTE: Context field `page.content` is omitted from debug output\nUsing layout rendering {context:#?}"
);

context.insert("page", &maplit::hashmap! {"content" => String::from_utf8(mapping.content.clone()).map_err(|source| Error::FromUtf8 {
msg: format!(
"Cannot apply layout '{}' to '{}'",
layout.display(),
mapping.destination.display()
),
source,
})?});
context.insert(
"page",
&maplit::hashmap! {
"content" => String::from_utf8(mapping.content.clone())
.map_err(|source| Error::FromUtf8 {
msg: format!(
"Cannot apply layout '{}' to '{}'",
layout.display(),
mapping.destination.display()
),
source,
})?,
// FIXME: replace this unwrap with better code
"source-path" => mapping.source.to_str().unwrap().to_owned()},
);

let layout_name = layout
.to_str()
Expand Down

0 comments on commit b9e61df

Please sign in to comment.