Add before/after navbar/content and make navbar not render when needed
This commit is contained in:
parent
fe3a74a1c1
commit
933189b7b2
23
config.toml
23
config.toml
@ -4,18 +4,25 @@ built_pages = ["test_page/about.toml", "test_page/other.toml"]
|
|||||||
use_default_css = true
|
use_default_css = true
|
||||||
javascript = []
|
javascript = []
|
||||||
css = []
|
css = []
|
||||||
|
#before_navbar_url = "/navbar.html"
|
||||||
|
#before_content_url = "/before_content.html"
|
||||||
|
#after_content_url = "/after_content.html"
|
||||||
#favicon = "favicon.png"
|
#favicon = "favicon.png"
|
||||||
#twitter_author = "@teascade"
|
#twitter_author = "@teascade"
|
||||||
#google_robots = "all"
|
#google_robots = "all"
|
||||||
#google_site_verification = ""
|
#google_site_verification = ""
|
||||||
|
|
||||||
[navbar]
|
#[navbar]
|
||||||
items = ["about", "other"]
|
#items = ["about", "other", "google"]
|
||||||
|
|
||||||
[navbar.item.about]
|
# [navbar.item.about]
|
||||||
title = "About"
|
# title = "About"
|
||||||
link = "/"
|
# link = "/"
|
||||||
|
|
||||||
[navbar.item.other]
|
# [navbar.item.other]
|
||||||
title = "Other"
|
# title = "Other"
|
||||||
link = "/other"
|
# link = "/other"
|
||||||
|
|
||||||
|
# [navbar.item.google]
|
||||||
|
# title = "Google!"
|
||||||
|
# link = "https://google.com"
|
@ -2,7 +2,7 @@ use toml;
|
|||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{Error as IOError, ErrorKind, Read};
|
use std::io::Read;
|
||||||
use std::error::Error as STDError;
|
use std::error::Error as STDError;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
@ -23,6 +23,9 @@ pub struct WebsiteConfig {
|
|||||||
pub javascript: Vec<String>,
|
pub javascript: Vec<String>,
|
||||||
pub css: Vec<String>,
|
pub css: Vec<String>,
|
||||||
pub favicon: Option<String>,
|
pub favicon: Option<String>,
|
||||||
|
pub before_navbar_url: Option<String>,
|
||||||
|
pub before_content_url: Option<String>,
|
||||||
|
pub after_content_url: Option<String>,
|
||||||
pub twitter_author: Option<String>,
|
pub twitter_author: Option<String>,
|
||||||
pub google_robots: Option<String>,
|
pub google_robots: Option<String>,
|
||||||
pub google_site_verification: Option<String>,
|
pub google_site_verification: Option<String>,
|
||||||
@ -122,6 +125,9 @@ pub struct PageConfig {
|
|||||||
pub description: String,
|
pub description: String,
|
||||||
pub content_path: String,
|
pub content_path: String,
|
||||||
pub favicon: Option<String>,
|
pub favicon: Option<String>,
|
||||||
|
pub before_navbar_url: Option<String>,
|
||||||
|
pub before_content_url: Option<String>,
|
||||||
|
pub after_content_url: Option<String>,
|
||||||
pub javascript: Option<Vec<String>>,
|
pub javascript: Option<Vec<String>>,
|
||||||
pub css: Option<Vec<String>>,
|
pub css: Option<Vec<String>>,
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ impl Template {
|
|||||||
"twitter_author".to_owned() => twitter_author,
|
"twitter_author".to_owned() => twitter_author,
|
||||||
|
|
||||||
"use_default_css".to_owned() => config.global_config.website.use_default_css.to_string(),
|
"use_default_css".to_owned() => config.global_config.website.use_default_css.to_string(),
|
||||||
"navbar".to_owned() => "true".to_owned(),
|
"navbar".to_owned() => config.global_config.navbar.is_some().to_string(),
|
||||||
|
|
||||||
"navbar_content".to_owned() => navbar_content,
|
"navbar_content".to_owned() => navbar_content,
|
||||||
"content".to_owned() => content
|
"content".to_owned() => content
|
||||||
|
@ -33,16 +33,17 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
{{if navbar}}
|
{{before_navbar}} {{if navbar}}
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
{{navbar_content}}
|
{{navbar_content}}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{{endif}}
|
{{endif}} {{before_content}}
|
||||||
<article>
|
<article>
|
||||||
{{content}}
|
{{content}}
|
||||||
</article>
|
</article>
|
||||||
|
{{after_content}}
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
@ -4,5 +4,8 @@ title = "About"
|
|||||||
description = "This is the test About page"
|
description = "This is the test About page"
|
||||||
content_path = "about.md"
|
content_path = "about.md"
|
||||||
favicon = "/favicon.png"
|
favicon = "/favicon.png"
|
||||||
|
#before_navbar_url = "/navbar.html"
|
||||||
|
#before_content_url = "/before_content.html"
|
||||||
|
#after_content_url = "/after_content.html"
|
||||||
#javascript = ["Additional JavaScript"]
|
#javascript = ["Additional JavaScript"]
|
||||||
#css = ["Additional CSS"]
|
#css = ["Additional CSS"]
|
@ -4,5 +4,8 @@ title = "Other!"
|
|||||||
description = "This is the .. other page"
|
description = "This is the .. other page"
|
||||||
content_path = "other.md"
|
content_path = "other.md"
|
||||||
#favicon = "optional_favicon.png"
|
#favicon = "optional_favicon.png"
|
||||||
|
#before_navbar_url = "/navbar.html"
|
||||||
|
#before_content_url = "/before_content.html"
|
||||||
|
#after_content_url = "/after_content.html"
|
||||||
#javascript = ["Additional JavaScript"]
|
#javascript = ["Additional JavaScript"]
|
||||||
#css = ["Additional CSS"]
|
#css = ["Additional CSS"]
|
Loading…
Reference in New Issue
Block a user