Add creation of individual pages.

This commit is contained in:
Dorian 2019-07-09 08:24:31 -04:00
parent 44cd9994cf
commit 94760c7af5
2 changed files with 10 additions and 3 deletions

View File

@ -213,13 +213,21 @@ fn main() {
let plugin_list = vec!["hello-world", "rookeries-link"];
let mut ctx = tera::Context::new();
ctx.insert("site", &project_site);
ctx.insert("current_page", &project_site.landing_page);
ctx.insert("current_page", "index");
ctx.insert("plugins", &plugin_list);
let render_page_str = render_engine.render("index", &ctx).unwrap();
write(build_directory.join("index.html"), render_page_str).expect("Failed to write index.html");
info!("{} Created the index HTML page.", "".green());
info!("Creating the pages...");
for page in &site_source_pages {
create_dir(&build_directory.join(&page.slug)).expect("Page directory creation failed.");
ctx.insert("current_page", &page.slug);
let render_page_str = render_engine.render("index", &ctx).unwrap();
write(build_directory.join(&page.slug).join("index.html"), render_page_str).expect("Failed to write index.html");
info!("{} Created the \"{}\" HTML page.", "".green(), &page.slug.green());
}
info!("{} Skipped.", "".yellow());
// Create the API representations.
@ -245,7 +253,6 @@ fn main() {
let api_pages_path = &api_path.join("pages");
create_dir(&api_pages_path).expect("Failed to create API for pages directory");
for page in site_source_pages {
let page_json = serde_json::to_string(&page).unwrap();
let page_json_filename = format!("{}.json", &page.slug);
write(api_pages_path.join(&page_json_filename), page_json).expect("Failed to write the page json");

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>{{ site.name }}{{ current_page }}</title>
<title>{{ site.name }} :: {{ current_page }}</title>
<link rel="icon" type="image/icon" href="{{ site.config.favicon }}" />
<link rel="stylesheet" type="text/css" media="screen" href="/static/js/rookeries.css" />
<meta charset="UTF-8" />