diff --git a/articles/context_processors.py b/articles/context_processors.py index 65b429d..022bde3 100644 --- a/articles/context_processors.py +++ b/articles/context_processors.py @@ -10,7 +10,7 @@ IGNORED_PATHS = [ def pages(request): if request.path in IGNORED_PATHS: return {} - return {"pages": Page.objects.filter(status=Article.PUBLISHED)} + return {"pages": Page.objects.filter(status=Article.PUBLISHED).exclude(position=0)} def drafts_count(request): diff --git a/articles/static/style.css b/articles/static/style.css index e4c6e4f..e4bfa9b 100644 --- a/articles/static/style.css +++ b/articles/static/style.css @@ -48,6 +48,10 @@ a { border-bottom: .3ex solid var(--accent); } +.index-page h2 { + margin-top: 2em; +} + .article-list h2 a { border-color: transparent; } diff --git a/articles/templates/articles/article_detail.html b/articles/templates/articles/article_detail.html index de72597..b517771 100644 --- a/articles/templates/articles/article_detail.html +++ b/articles/templates/articles/article_detail.html @@ -1,8 +1,6 @@ {% extends 'articles/base.html' %} -{% block title %} - {{ article.title }} -{% endblock %} +{% block title %}{{ article.title }} | {% endblock %} {% block content %}

{{ article.title }}{% if article.status != article.PUBLISHED %} diff --git a/articles/templates/articles/article_list.html b/articles/templates/articles/article_list.html index 448c330..ccde986 100644 --- a/articles/templates/articles/article_list.html +++ b/articles/templates/articles/article_list.html @@ -1,25 +1,26 @@ {% extends 'articles/base.html' %} -{% block title %} - {{ title_header }} -{% endblock %} +{% block title %}{% endblock %} {% block content %}

{{ blog_title }}{% if title %} · {{ title }}{% endif %}

-

{{ blog_description }}

- +

{{ blog_description }} {% include "articles/admin_link_snippet.html" %}

+
+

Blog posts

+ +
+
+

{{ index_page.title }}

+
+ {{ index_page.get_formatted_content|safe }} +
+
{% endblock %} diff --git a/articles/templates/articles/base.html b/articles/templates/articles/base.html index 586c52b..73d04e0 100644 --- a/articles/templates/articles/base.html +++ b/articles/templates/articles/base.html @@ -4,7 +4,7 @@ - {% block title %}Home{% endblock %} | Gab's Notes + {% block title %}Home | {% endblock %}Gab's Notes diff --git a/articles/views/html.py b/articles/views/html.py index cdbb867..12d4764 100644 --- a/articles/views/html.py +++ b/articles/views/html.py @@ -9,6 +9,8 @@ from articles.models import Article, Page class BaseArticleListView(generic.ListView): + paginate_by = 10 + def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context["blog_title"] = settings.BLOG["title"] @@ -23,7 +25,10 @@ class ArticlesListView(BaseArticleListView): def get_context_data(self, **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