From fb7b5646ca572f5036750aeaaf55fb689455b041 Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Sat, 22 Apr 2017 11:44:56 +0900 Subject: [PATCH] Only load templates ending by .html Avoid issues with temp files from some editors --- CHANGELOG.md | 1 + README.md | 2 +- src/site.rs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 093ef9b6..4d4ded70 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Add tables and footnotes support in markdown - Add previous/previous_in_section/next/next_in_section/summary to `Page` - Add more language syntaxes +- Only load templates ending by `.html` ## 0.0.3 (2017-04-05) - Add some colours in console diff --git a/README.md b/README.md index b57ab61e..d747337d 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ If you want to add some of your own variables, you will need to put them in the they will be silently ignored. ### Templates -Templates live in the `templates/` directory. +Templates live in the `templates/` directory and the files need to end by `.html`. Only [Tera](https://github.com/Keats/tera) templates are supported. Each kind of page get their own variables: diff --git a/src/site.rs b/src/site.rs index d82127e5..74612ce3 100644 --- a/src/site.rs +++ b/src/site.rs @@ -79,7 +79,7 @@ impl Site { pub fn new>(path: P, config_file: &str) -> Result { let path = path.as_ref(); - let tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*"); + let tpl_glob = format!("{}/{}", path.to_string_lossy().replace("\\", "/"), "templates/**/*.html"); let mut tera = Tera::new(&tpl_glob).chain_err(|| "Error parsing templates")?; tera.extend(&GUTENBERG_TERA)?; tera.register_filter("markdown", filters::markdown);