Skip to content

Commit

Permalink
aider: Removed default filter from page.html template and ensured…
Browse files Browse the repository at this point in the history
… correct passing of `title` variable.

# Aider chat conversation:

USER: Error: Failed to serve the site
Error: Error parsing templates from the /templates directory
Error: Reason:
* Failed to parse "/home/ian/code/freenet/web/templates/page.html"
 --> 3:42
  |
3 | {% block title %}{{ page.title | default("No Title") }}{% endblock %}
  |                                          ^---
  |
  = expected an identifier (must start with a-z)

ASSISTANT: The error indicates that the `default` filter is not recognized in the context of the template engine being used. We need to ensure that the `title` variable is correctly passed to the template.

Let's update the `page.html` template to remove the `default` filter and ensure that the `title` variable is correctly passed.

Here are the *SEARCH/REPLACE* blocks:

templates/page.html
```python
<<<<<<< SEARCH
{% block title %}{{ page.title | default("No Title") }}{% endblock %}
=======
{% block title %}{{ page.title }}{% endblock %}
>>>>>>> REPLACE
```

This change removes the `default` filter and directly uses `page.title`. If `page.title` is not set, it will result in an empty title, but it will avoid the parsing error.
  • Loading branch information
sanity committed Jun 12, 2024
1 parent 398083e commit b8ffa42
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/page.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{% extends "base.html" %}

{% block title %}{{ page.title | default("No Title") }}{% endblock %}
{% block title %}{{ page.title }}{% endblock %}

{% block content %}
<article class="content">
Expand Down

0 comments on commit b8ffa42

Please sign in to comment.