terminal-labs / lektor-jinja-content

Render Lektor content fields with Jinja2.
Other
11 stars 5 forks source link

fatal issue when a field is not defined #13

Open jvanasco opened 5 years ago

jvanasco commented 5 years ago

We allow for a field to override another, such as this:

page.html:

{% extends "site_layout.html" %}
{% block meta_title %}{{ this.meta_title or this.title }}{% endblock %}

site_layout.html:

<title>{% block title %}title{% endblock %}</title>
<meta name="title" content="{% block meta_title %}{% endblock %}"/>

A fatal exception is raised if lektor-jinja-content is enabled and the meta_title or title is not defined in a contents.lr file.

valid:

title: sample title
---
meta_title: sample meta_title

invalid:

title: sample title

I am working on a PR