Ajout des fonctionnalités de blog : modèles, migrations, vues, templates, contexte et styles.
This commit is contained in:
parent
3e44013132
commit
c1749068af
16 changed files with 245 additions and 9 deletions
24
templates/blog/details.html
Normal file
24
templates/blog/details.html
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block title %} | Blog : {{ post.name }}{% endblock %}
|
||||
{% block og_title %}Blog de Partir De Zéro : {{ post.name }}{% endblock %}
|
||||
{% block description %}{{ post.content|striptags|truncatewords:20 }}{% endblock %}
|
||||
{% block og_description %}{{ post.content|striptags|truncatewords:20 }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="blog post-detail">
|
||||
<header class="post-header">
|
||||
<h1 class="post-title">{{ post.name }}</h1>
|
||||
<div class="post-meta">
|
||||
<span class="post-date"><i class="fa-regular fa-calendar"></i> {{ post.created_at|date:"d F Y" }}</span>
|
||||
{% if post.tags %}
|
||||
<span class="sep">•</span>
|
||||
<span class="post-tags"><i class="fa-solid fa-tag"></i> {{ post.tags }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<article class="post-content prose">
|
||||
{{ post.content|safe }}
|
||||
</article>
|
||||
</section>
|
||||
{% endblock %}
|
||||
17
templates/blog/home.html
Normal file
17
templates/blog/home.html
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
{% extends 'layout.html' %}
|
||||
{% block title %} | Blog{% endblock %}
|
||||
{% block og_title %}Blog de Partir De Zéro{% endblock %}
|
||||
{% block description %}{{ settings.blog_description }}{% endblock %}
|
||||
{% block og_description %}{{ settings.blog_description }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="blog blog-home">
|
||||
<header class="blog-header">
|
||||
<h1 class="blog-title">{{ settings.blog_title|default:'Blog' }}</h1>
|
||||
<p class="blog-description">{{ settings.blog_description }}</p>
|
||||
</header>
|
||||
|
||||
<h2 class="sr-only">Liste des articles</h2>
|
||||
{% include 'blog/partials/_posts_list.html' %}
|
||||
</section>
|
||||
{% endblock %}
|
||||
20
templates/blog/partials/_posts_list.html
Normal file
20
templates/blog/partials/_posts_list.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<div class="post-list">
|
||||
{% for post in posts %}
|
||||
<article class="post-card">
|
||||
<h3 class="post-card-title"><a href="{% url 'blog:post_detail' post.slug %}">{{ post.name }}</a></h3>
|
||||
<div class="post-meta">
|
||||
<span class="post-date"><i class="fa-regular fa-calendar"></i> {{ post.created_at|date:"d F Y" }}</span>
|
||||
{% if post.tags %}
|
||||
<span class="sep">•</span>
|
||||
<span class="post-tags"><i class="fa-solid fa-tag"></i> {{ post.tags }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<p class="post-excerpt">{{ post.content|striptags|truncatewords:26 }}</p>
|
||||
<div class="post-actions">
|
||||
<a class="button button-secondary" href="{% url 'blog:post_detail' post.slug %}">Lire l'article →</a>
|
||||
</div>
|
||||
</article>
|
||||
{% empty %}
|
||||
<p>Aucun article pour le moment.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue