From 3caf44198194339b7af708534f5b4af9e4dc8ea7 Mon Sep 17 00:00:00 2001 From: Michael Clayton Date: Tue, 11 Jan 2022 06:35:58 -0500 Subject: [PATCH] add theme's robots.txt to tera with name "robots.txt" (#1722) * add theme's robots.txt to tera with correct name * add TODO reminder to add tests --- components/templates/src/lib.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/templates/src/lib.rs b/components/templates/src/lib.rs index 56cbd57563..7104e543aa 100644 --- a/components/templates/src/lib.rs +++ b/components/templates/src/lib.rs @@ -81,8 +81,12 @@ pub fn load_tera(path: &Path, config: &Config) -> Result { .map_err(|e| Error::chain("Error parsing templates from themes", e))?; rewrite_theme_paths(&mut tera_theme, theme); + // TODO: add tests for theme-provided robots.txt (https://github.com/getzola/zola/pull/1722) if theme_path.join("templates").join("robots.txt").exists() { - tera_theme.add_template_file(theme_path.join("templates").join("robots.txt"), None)?; + tera_theme.add_template_file( + theme_path.join("templates").join("robots.txt"), + Some("robots.txt"), + )?; } tera.extend(&tera_theme)?; }