Skip to content

Commit

Permalink
Add jinja templates for blog
Browse files Browse the repository at this point in the history
  • Loading branch information
pablodiegoss committed May 26, 2024
1 parent c721e43 commit 4276c2a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/blog/jinja2/blog/category.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "blog/index.jinja2" %}

{% block page_title %}
<h2>{{ category }}</h2>
{% endblock page_title %}
17 changes: 17 additions & 0 deletions src/blog/jinja2/blog/detail.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% extends '/core/home.jinja2' %}


{% block content %}
{% block page_title %}
<h2>{{ post.title }}</h2>
{% endblock page_title %}
<small>
{{ post.created }} | Categories:
{% for category in post.categories.all() %}
<a href="{{ url('blog_category',args=[category.name])}}">
{{ category.name }}
</a>
{% endfor %}
</small>
<p>{{ post.body }}</p>
{% endblock %}
22 changes: 22 additions & 0 deletions src/blog/jinja2/blog/index.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{% extends '/core/home.jinja2' %}


{% block content %}
{% block page_title %}
<h2>Blog Posts</h2>
{% endblock page_title %}

{% for post in posts %}
<h3><a href="{{ url('blog_detail', args=[post.pk])}}">{{ post.title }}</a></h3>
<small>
{{ post.created.date() }} | Categories:
{% for category in post.categories.all() %}
<a href="{{ url('blog_category', args=[category.name])}}">
{{ category.name }}
</a>
{% endfor %}
</small>
<p>{{ post.body[:PREVIEW_SIZE]}}...</p>
{% endfor %}

{% endblock %}

0 comments on commit 4276c2a

Please sign in to comment.