Display an index page below the articles without abstract
This commit is contained in:
parent
ffe246033e
commit
4f354c0014
6 changed files with 38 additions and 24 deletions
|
@ -10,7 +10,7 @@ IGNORED_PATHS = [
|
||||||
def pages(request):
|
def pages(request):
|
||||||
if request.path in IGNORED_PATHS:
|
if request.path in IGNORED_PATHS:
|
||||||
return {}
|
return {}
|
||||||
return {"pages": Page.objects.filter(status=Article.PUBLISHED)}
|
return {"pages": Page.objects.filter(status=Article.PUBLISHED).exclude(position=0)}
|
||||||
|
|
||||||
|
|
||||||
def drafts_count(request):
|
def drafts_count(request):
|
||||||
|
|
|
@ -48,6 +48,10 @@ a {
|
||||||
border-bottom: .3ex solid var(--accent);
|
border-bottom: .3ex solid var(--accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.index-page h2 {
|
||||||
|
margin-top: 2em;
|
||||||
|
}
|
||||||
|
|
||||||
.article-list h2 a {
|
.article-list h2 a {
|
||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
{% extends 'articles/base.html' %}
|
{% extends 'articles/base.html' %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}{{ article.title }} | {% endblock %}
|
||||||
{{ article.title }}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<article class="article-detail">
|
<article class="article-detail">
|
||||||
<h1>{{ article.title }}{% if article.status != article.PUBLISHED %}
|
<h1>{{ article.title }}{% if article.status != article.PUBLISHED %}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{% extends 'articles/base.html' %}
|
{% extends 'articles/base.html' %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}{% endblock %}
|
||||||
{{ title_header }}
|
|
||||||
{% endblock %}
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{{ blog_title }}{% if title %} · {{ title }}{% endif %}</h1>
|
<h1>{{ blog_title }}{% if title %} · {{ title }}{% endif %}</h1>
|
||||||
<p class="metadata">{{ blog_description }}</p>
|
<p class="metadata">{{ blog_description }} {% include "articles/admin_link_snippet.html" %}</p>
|
||||||
|
<section class="blog-posts">
|
||||||
|
<h2>Blog posts</h2>
|
||||||
<ul>
|
<ul>
|
||||||
{% for article in articles %}
|
{% for article in articles %}
|
||||||
<li>
|
<li>
|
||||||
|
@ -20,6 +20,7 @@
|
||||||
<li>No article here. Come back later 🙂</li>
|
<li>No article here. Come back later 🙂</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</section>
|
||||||
<nav class="pagination">
|
<nav class="pagination">
|
||||||
<div class="older">
|
<div class="older">
|
||||||
{% if page_obj.has_next %}
|
{% if page_obj.has_next %}
|
||||||
|
@ -32,4 +33,10 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
<section class="index-page">
|
||||||
|
<h2>{{ index_page.title }}</h2>
|
||||||
|
<div>
|
||||||
|
{{ index_page.get_formatted_content|safe }}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>{% block title %}Home{% endblock %} | Gab's Notes</title>
|
<title>{% block title %}Home | {% endblock %}Gab's Notes</title>
|
||||||
<link rel="stylesheet" id="code-light" href="{% static 'code-light.css' %}" type="text/css">
|
<link rel="stylesheet" id="code-light" href="{% static 'code-light.css' %}" type="text/css">
|
||||||
<link rel="stylesheet" id="code-dark" href="{% static 'code-dark.css' %}" type="text/css">
|
<link rel="stylesheet" id="code-dark" href="{% static 'code-dark.css' %}" type="text/css">
|
||||||
<link rel="stylesheet" href="{% static 'style.css' %}" type="text/css">
|
<link rel="stylesheet" href="{% static 'style.css' %}" type="text/css">
|
||||||
|
|
|
@ -9,6 +9,8 @@ from articles.models import Article, Page
|
||||||
|
|
||||||
|
|
||||||
class BaseArticleListView(generic.ListView):
|
class BaseArticleListView(generic.ListView):
|
||||||
|
paginate_by = 10
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["blog_title"] = settings.BLOG["title"]
|
context["blog_title"] = settings.BLOG["title"]
|
||||||
|
@ -23,7 +25,10 @@ class ArticlesListView(BaseArticleListView):
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["title_header"] = "Articles"
|
index_page = Page.objects.filter(
|
||||||
|
status=Article.PUBLISHED, position=0
|
||||||
|
).first() # type: Page
|
||||||
|
context["index_page"] = index_page
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue