Use platform separator for shortcodes paths
This commit is contained in:
parent
723729b6d1
commit
84f10f6b69
|
@ -5,7 +5,6 @@ use tera::{Map, Value};
|
|||
|
||||
use content::{Page, Section};
|
||||
use library::Library;
|
||||
use rendering::Header;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize)]
|
||||
pub struct TranslatedContent<'a> {
|
||||
|
|
|
@ -240,7 +240,6 @@ fn can_rebuild_after_renaming_non_md_asset_in_colocated_folder() {
|
|||
fn can_rebuild_after_deleting_file() {
|
||||
let tmp_dir = tempdir().expect("create temp dir");
|
||||
let (site_path, mut site) = load_and_build_site!(tmp_dir, "test_site");
|
||||
println!("{:#?}", site.tera.templates.keys().collect::<Vec<_>>());
|
||||
let path = site_path.join("content").join("posts").join("fixed-slug.md");
|
||||
fs::remove_file(&path).unwrap();
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use std::path::MAIN_SEPARATOR;
|
||||
|
||||
use pest::iterators::Pair;
|
||||
use pest::Parser;
|
||||
use regex::Regex;
|
||||
|
@ -112,7 +114,7 @@ fn render_shortcode(
|
|||
}
|
||||
tera_context.extend(context.tera_context.clone());
|
||||
|
||||
let template_name = format!("shortcodes/{}.html", name);
|
||||
let template_name = format!("shortcodes{}{}.html", MAIN_SEPARATOR, name);
|
||||
|
||||
let res = utils::templates::render_template(&template_name, &context.tera, tera_context, &None)
|
||||
.map_err(|e| Error::chain(format!("Failed to render {} shortcode", name), e))?;
|
||||
|
|
Loading…
Reference in a new issue