Fix robots.txt template for real this time

This commit is contained in:
Vincent Prouillet 2018-10-01 17:50:42 +02:00
parent 99215a4523
commit 2cf99c3cfc
3 changed files with 4 additions and 3 deletions

View file

@ -122,7 +122,7 @@ impl Site {
// TODO: Tera doesn't use globset right now so we can load the robots.txt as part
// of the glob above, therefore we load it manually if it exists.
if path.join("templates").join("robots.txt").exists() {
tera.add_template_file(path.join("templates").join("robots.txt"), None)?;
tera.add_template_file(path.join("templates").join("robots.txt"), Some("robots.txt"))?;
}
let content_path = path.join("content");

View file

@ -167,7 +167,7 @@ fn can_build_site_without_live_reload() {
assert!(!file_contains!(public, "sitemap.xml", "draft"));
// robots.txt has been rendered from the template
assert!(!file_contains!(public, "robots.txt", "Hello"));
assert!(file_contains!(public, "robots.txt", "User-agent: gutenberg"));
}
#[test]

View file

@ -1 +1,2 @@
Hello
User-agent: gutenberg
Allow: /