for word in recipe.recipe["information"]["keywords"]:
if word in keywords:
- keywords[word].append((recipe.recipe["information"]["title"], recipe.recipe["html"]))
+ keywords[word].append((
+ recipe.recipe["html"],
+ recipe.recipe["information"]["title"],
+ recipe.recipe["information"]["description"]
+ ))
else:
- keywords |= { word: [(recipe.recipe["information"]["title"], recipe.recipe["html"])]}
+ keywords |= { word: [(
+ recipe.recipe["html"],
+ recipe.recipe["information"]["title"],
+ recipe.recipe["information"]["description"]
+ )]}
template = self.html_environment.get_template("index.html")
with open("index.html", "w") as f:
<h3>All recipes</h3>
<ul>
{% for recipe in recipes %}
- <li><a href="recipes/{{ recipe.recipe.html }}">{{ recipe.recipe.information.title }}</a></li>
+ <li><a href="recipes/{{ recipe.recipe.html }}">{{ recipe.recipe.information.title }}</a> <em>{{ recipe.recipe.information.description }}</em></li>
{% endfor %}
</ul>
<h3>Keywords</h3>
<h4>{{ word }}</h4>
<ul>
{% for item in list %}
- <li><a href="recipes/{{ item.1 }}">{{ item.0 }}</a></li>
+ <li><a href="recipes/{{ item.0 }}">{{ item.1 }}</a> <em>{{ item.2 }}</em></li>
{% endfor %}
</ul>
{% endfor %}