Skip to content

Commit

Permalink
Make base_url available for .hbs to set base href if configured.
Browse files Browse the repository at this point in the history
When site_url is configured make it available for hbs to set base href (using base_url)
  • Loading branch information
prasad83 authored Dec 20, 2024
1 parent 59e6afc commit bff40ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ impl HtmlHandlebars {
ch.name.clone() + " - " + book_title
};

// Make base_url available for .hbs to set base href if required.
if let Some(site_url) = ctx.html_config.site_url {
ctx.data.insert("base_url".to_owned(), json!(site_url.clone()));
};

ctx.data.insert("path".to_owned(), json!(path));
ctx.data.insert("content".to_owned(), json!(content));
ctx.data.insert("chapter_title".to_owned(), json!(ch.name));
Expand Down

0 comments on commit bff40ef

Please sign in to comment.