Browse Source

Fix robots.txt template for real this time

index-subcmd
Vincent Prouillet 5 years ago
parent
commit
2cf99c3cfc
3 changed files with 4 additions and 3 deletions
  1. +1
    -1
      components/site/src/lib.rs
  2. +1
    -1
      components/site/tests/site.rs
  3. +2
    -1
      test_site/templates/robots.txt

+ 1
- 1
components/site/src/lib.rs 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");


+ 1
- 1
components/site/tests/site.rs 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]


+ 2
- 1
test_site/templates/robots.txt View File

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

Loading…
Cancel
Save