Skip to content

Commit 105f8db

Browse files
committed
Rename templates for zola
1 parent 6e1f817 commit 105f8db

File tree

8 files changed

+9
-8
lines changed

8 files changed

+9
-8
lines changed

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ impl Generator {
8080
let mut tera = Tera::new("templates/*")?;
8181
tera.register_filter("month_name", month_name);
8282
tera.register_filter("escape_hbs", escape_hbs);
83+
tera.autoescape_on(vec![]); // disable auto-escape for .html templates
8384
Ok(Generator {
8485
tera,
8586
blogs: self::blogs::load(posts_directory.as_ref())?,
@@ -188,7 +189,7 @@ impl Generator {
188189
"root": blog.path_back_to_root(),
189190
});
190191
let path = blog.prefix().join("index.html");
191-
self.render_template(&path, "index.tera", data)?;
192+
self.render_template(&path, "index.html", data)?;
192193
Ok(path)
193194
}
194195

@@ -212,7 +213,7 @@ impl Generator {
212213
});
213214

214215
let path = path.join(filename);
215-
self.render_template(&path, &format!("{}.tera", post.layout), data)?;
216+
self.render_template(&path, &format!("{}.html", post.layout), data)?;
216217
Ok(path)
217218
}
218219

@@ -224,7 +225,7 @@ impl Generator {
224225
"feed_updated": chrono::Utc::now().with_nanosecond(0).unwrap().to_rfc3339(),
225226
});
226227

227-
self.render_template(blog.prefix().join("feed.xml"), "feed.tera", data)?;
228+
self.render_template(blog.prefix().join("feed.xml"), "feed.xml", data)?;
228229
Ok(())
229230
}
230231

File renamed without changes.
File renamed without changes.
File renamed without changes.

templates/index.tera renamed to templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "layout.tera" %}
1+
{% extends "layout.html" %}
22
{% block page %}
33
<header class="mt3 mt0-ns mb4-ns">
44
<div class="container flex flex-column flex-row-l justify-between-l">

templates/layout.tera renamed to templates/layout.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{% import "headers.tera" as headers %}
2-
{% import "nav.tera" as nav %}
3-
{% import "footer.tera" as footer %}
1+
{% import "headers.html" as headers %}
2+
{% import "nav.html" as nav %}
3+
{% import "footer.html" as footer %}
44
<!DOCTYPE html>
55
<html lang="en">
66
<head>
File renamed without changes.

templates/post.tera renamed to templates/post.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% extends "layout.tera" %}
1+
{% extends "layout.html" %}
22
{% block page %}
33
<section id="{{post.title | escape_hbs}}" class="white">
44
<div class="w-100 mw-none ph3 mw8-m mw8-l center f3">

0 commit comments

Comments
 (0)