feat(templates): add Tera runtime template engine
Lay groundwork for user-editable templates by adding Tera as a runtime template engine alongside the existing maud templates. Changes: - Add tera dependency - Create TemplateEngine struct with render methods - Add TemplateLoad/TemplateRender error variants - Add section_type/template fields to Frontmatter - Create templates/ directory with base, page, section, and content templates Dead code warnings are expected; TemplateEngine will be wired in to replace maud in subsequent commits.
This commit is contained in:
20
templates/section/blog.html
Normal file
20
templates/section/blog.html
Normal file
@@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ section.title }}</h1>
|
||||
<ul class="post-list">
|
||||
{% for item in items %}
|
||||
<li>
|
||||
<a href="./{{ item.slug }}.html">
|
||||
<span class="title">{{ item.frontmatter.title }}</span>
|
||||
{% if item.frontmatter.date %}
|
||||
<time class="date">{{ item.frontmatter.date }}</time>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% if item.frontmatter.description %}
|
||||
<p class="description">{{ item.frontmatter.description }}</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
15
templates/section/default.html
Normal file
15
templates/section/default.html
Normal file
@@ -0,0 +1,15 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ section.title }}</h1>
|
||||
<ul class="item-list">
|
||||
{% for item in items %}
|
||||
<li>
|
||||
<a href="./{{ item.slug }}.html">{{ item.frontmatter.title }}</a>
|
||||
{% if item.frontmatter.description %}
|
||||
<p>{{ item.frontmatter.description }}</p>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
24
templates/section/projects.html
Normal file
24
templates/section/projects.html
Normal file
@@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ section.title }}</h1>
|
||||
<ul class="project-cards">
|
||||
{% for item in items %}
|
||||
<li class="card">
|
||||
{% if item.frontmatter.link_to %}
|
||||
<a href="{{ item.frontmatter.link_to }}" target="_blank" rel="noopener">
|
||||
<h2>{{ item.frontmatter.title }}</h2>
|
||||
{% if item.frontmatter.description %}
|
||||
<p>{{ item.frontmatter.description }}</p>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% else %}
|
||||
<h2>{{ item.frontmatter.title }}</h2>
|
||||
{% if item.frontmatter.description %}
|
||||
<p>{{ item.frontmatter.description }}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user