Create a page header struct.
This commit is contained in:
@@ -4,6 +4,7 @@ use std::path::PathBuf;
|
||||
|
||||
use crate::config::Config;
|
||||
use crate::context::GlobalSettings;
|
||||
use crate::context::PageHeader;
|
||||
use crate::context::RenderBlogPostPage;
|
||||
use crate::context::RenderDocumentElement;
|
||||
use crate::context::RenderRealFootnoteDefinition;
|
||||
@@ -37,6 +38,10 @@ pub(crate) fn convert_blog_post_page_to_render_context<D: AsRef<Path>, F: AsRef<
|
||||
"blog_post.js",
|
||||
)?];
|
||||
let global_settings = GlobalSettings::new(page.title.clone(), css_files, js_files);
|
||||
let page_header = PageHeader::new(
|
||||
config.get_site_title().map(str::to_string),
|
||||
Some(get_web_path(config, output_directory, output_file, "")?),
|
||||
);
|
||||
let link_to_blog_post = get_web_path(
|
||||
config,
|
||||
output_directory,
|
||||
@@ -100,9 +105,7 @@ fn get_web_path<D: AsRef<Path>, F: AsRef<Path>, P: AsRef<Path>>(
|
||||
containing_file_relative_to_output_directory
|
||||
.parent()
|
||||
.ok_or("File should exist in a folder.")?,
|
||||
path_from_web_root
|
||||
.parent()
|
||||
.ok_or("File should exist in a folder.")?,
|
||||
path_from_web_root.parent().unwrap_or(&Path::new("")),
|
||||
)
|
||||
.collect::<PathBuf>();
|
||||
// Subtracting 1 from the depth to "remove" the file name.
|
||||
|
||||
Reference in New Issue
Block a user