Skip to content

Commit

Permalink
add theme's robots.txt to tera with name "robots.txt" (#1722)
Browse files Browse the repository at this point in the history
* add theme's robots.txt to tera with correct name

* add TODO reminder to add tests
  • Loading branch information
mwcz authored and Keats committed Jan 23, 2022
1 parent faec345 commit 78132a8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion components/templates/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,12 @@ pub fn load_tera(path: &Path, config: &Config) -> Result<Tera> {
.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)?;
}
Expand Down

0 comments on commit 78132a8

Please sign in to comment.