Add creation of individual pages.
This commit is contained in:
parent
44cd9994cf
commit
94760c7af5
|
@ -213,13 +213,21 @@ fn main() {
|
||||||
let plugin_list = vec!["hello-world", "rookeries-link"];
|
let plugin_list = vec!["hello-world", "rookeries-link"];
|
||||||
let mut ctx = tera::Context::new();
|
let mut ctx = tera::Context::new();
|
||||||
ctx.insert("site", &project_site);
|
ctx.insert("site", &project_site);
|
||||||
ctx.insert("current_page", &project_site.landing_page);
|
ctx.insert("current_page", "index");
|
||||||
ctx.insert("plugins", &plugin_list);
|
ctx.insert("plugins", &plugin_list);
|
||||||
let render_page_str = render_engine.render("index", &ctx).unwrap();
|
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");
|
write(build_directory.join("index.html"), render_page_str).expect("Failed to write index.html");
|
||||||
info!("{} Created the index HTML page.", "✔".green());
|
info!("{} Created the index HTML page.", "✔".green());
|
||||||
|
|
||||||
info!("Creating the pages...");
|
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());
|
info!("{} Skipped.", "◉".yellow());
|
||||||
|
|
||||||
// Create the API representations.
|
// Create the API representations.
|
||||||
|
@ -245,7 +253,6 @@ fn main() {
|
||||||
let api_pages_path = &api_path.join("pages");
|
let api_pages_path = &api_path.join("pages");
|
||||||
create_dir(&api_pages_path).expect("Failed to create API for pages directory");
|
create_dir(&api_pages_path).expect("Failed to create API for pages directory");
|
||||||
for page in site_source_pages {
|
for page in site_source_pages {
|
||||||
|
|
||||||
let page_json = serde_json::to_string(&page).unwrap();
|
let page_json = serde_json::to_string(&page).unwrap();
|
||||||
let page_json_filename = format!("{}.json", &page.slug);
|
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");
|
write(api_pages_path.join(&page_json_filename), page_json).expect("Failed to write the page json");
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<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="icon" type="image/icon" href="{{ site.config.favicon }}" />
|
||||||
<link rel="stylesheet" type="text/css" media="screen" href="/static/js/rookeries.css" />
|
<link rel="stylesheet" type="text/css" media="screen" href="/static/js/rookeries.css" />
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
|
|
Loading…
Reference in New Issue