From 2cf99c3cfccf86cc77d7dcc775915b9b0e56e82e Mon Sep 17 00:00:00 2001 From: Vincent Prouillet Date: Mon, 1 Oct 2018 17:50:42 +0200 Subject: [PATCH] Fix robots.txt template for real this time --- components/site/src/lib.rs | 2 +- components/site/tests/site.rs | 2 +- test_site/templates/robots.txt | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index fb8747d7..e7de7dab 100644 --- a/components/site/src/lib.rs +++ b/components/site/src/lib.rs @@ -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"); diff --git a/components/site/tests/site.rs b/components/site/tests/site.rs index 0c6a3078..98b4bc0d 100644 --- a/components/site/tests/site.rs +++ b/components/site/tests/site.rs @@ -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] diff --git a/test_site/templates/robots.txt b/test_site/templates/robots.txt index e965047a..75e6189d 100644 --- a/test_site/templates/robots.txt +++ b/test_site/templates/robots.txt @@ -1 +1,2 @@ -Hello +User-agent: gutenberg +Allow: /