Skip to content

Commit

Permalink
fix(exporting): 🚑 fixed partial flattening in exporting
Browse files Browse the repository at this point in the history
We should be using a fully fledged directory structure.
Also added an example link to confirm functionality.
  • Loading branch information
arctic-hen7 committed Oct 2, 2021
1 parent d059426 commit bdbdc56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions examples/i18n/src/templates/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub fn post_page(props: PostPageProps) -> SycamoreTemplate<G> {
(content)
}
a(href = link!("/post")) { "Root post page" }
br()
a(href = link!("/post/blah/test/blah")) { "Complex post page" }
}
}

Expand Down
8 changes: 3 additions & 5 deletions packages/perseus/src/export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub async fn export_app(
// Loop over every partial
for (path, template_path) in render_cfg {
// We need the encoded path to reference flattened build artifacts
// But we don't create a flattened system with exporting, everything is properly created in a directory structure
let path_encoded = urlencoding::encode(&path).to_string();
// Get the template itself
let template = templates.get(&template_path);
Expand Down Expand Up @@ -104,7 +105,7 @@ pub async fn export_app(
let partial = serde_json::to_string(&page_data).unwrap();
immutable_store
.write(
&format!("exported/.perseus/page/{}/{}.json", locale, &path_encoded),
&format!("exported/.perseus/page/{}/{}.json", locale, &path),
&partial,
)
.await?;
Expand All @@ -128,10 +129,7 @@ pub async fn export_app(
let partial = serde_json::to_string(&page_data).unwrap();
immutable_store
.write(
&format!(
"exported/.perseus/page/{}/{}.json",
locales.default, &path_encoded
),
&format!("exported/.perseus/page/{}/{}.json", locales.default, &path),
&partial,
)
.await?;
Expand Down

0 comments on commit bdbdc56

Please sign in to comment.