cli: Fix issue with rendering older sites.
This commit is contained in:
parent
d097eeecbb
commit
1c8b785d12
|
@ -102,7 +102,8 @@ pub fn build_site(project: &Project, activate_dev_mode: bool) -> Result<(), Rook
|
|||
success_message("Build information compiled.");
|
||||
|
||||
let render_engine = prepare_render_engine(project)?;
|
||||
let mut ctx = prepare_render_context(activate_dev_mode, older_site, &project_site, &build_info);
|
||||
let mut ctx =
|
||||
prepare_render_context(activate_dev_mode, &older_site, &project_site, &build_info);
|
||||
success_message("Render system initialized.");
|
||||
|
||||
header_message("Rendering the site...");
|
||||
|
@ -126,6 +127,9 @@ pub fn build_site(project: &Project, activate_dev_mode: bool) -> Result<(), Rook
|
|||
|
||||
create_directory(&page_directory, FileType::Page)?;
|
||||
ctx.insert("page", &page);
|
||||
if older_site.is_some() {
|
||||
ctx.insert("current_page", &page.slug);
|
||||
}
|
||||
let render_page_str = render_engine.render("sample", &ctx).map_err(|err| {
|
||||
let template_render_path = if &page.slug == "index" {
|
||||
String::from("index")
|
||||
|
@ -256,7 +260,7 @@ fn build_artifact(build_info: &BuildInfo, api_path: &PathBuf) -> Result<(), Rook
|
|||
|
||||
fn prepare_render_context(
|
||||
activate_dev_mode: bool,
|
||||
older_site: Option<PreStable18Site>,
|
||||
older_site: &Option<PreStable18Site>,
|
||||
project_site: &Site,
|
||||
build_info: &BuildInfo,
|
||||
) -> tera::Context {
|
||||
|
|
Loading…
Reference in New Issue