diff --git a/components/site/src/lib.rs b/components/site/src/lib.rs index fb8747d..e7de7da 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 0c6a307..98b4bc0 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 e965047..75e6189 100644 --- a/test_site/templates/robots.txt +++ b/test_site/templates/robots.txt @@ -1 +1,2 @@ -Hello +User-agent: gutenberg +Allow: /