Update articles list look with blog title and description

This commit is contained in:
Gabriel Augendre 2020-09-12 17:20:56 +02:00
parent bd938138a2
commit 698a2db6a7
No known key found for this signature in database
GPG key ID: 1E693F4CE4AEE7B4
6 changed files with 18 additions and 10 deletions

View file

@ -12,6 +12,7 @@
--error-text: #721c24; --error-text: #721c24;
--warning-background: #fff3cd; --warning-background: #fff3cd;
--warning-text: #856404; --warning-text: #856404;
--description-margin: .2rem;
} }
html { html {
@ -71,16 +72,16 @@ a {
margin-top: 4em; margin-top: 4em;
} }
.article-list h2, .article-detail h1 { .article-list h2, h1 {
margin-bottom: .2em; margin-bottom: var(--description-margin);
} }
.article-detail h1 { .article-detail h1 {
font-size: 2em; font-size: 2em;
} }
.date { .metadata {
margin-top: .2em; margin-top: var(--description-margin);
color: var(--main2); color: var(--main2);
} }

View file

@ -1,10 +1,11 @@
{% extends 'articles/base.html' %} {% extends 'articles/base.html' %}
{% block title %} {% block title %}
{{ title }} {{ title_header }}
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>{{ title }} list</h1> <h1>{{ blog_title }}{% if title %} &middot; {{ title }}{% endif %}</h1>
<p class="metadata">{{ blog_description }}</p>
{% for article in articles %} {% for article in articles %}
<article class="article-list"> <article class="article-list">
<h2><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></h2> <h2><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></h2>

View file

@ -14,7 +14,7 @@
</head> </head>
<body> <body>
<nav> <nav>
<a href="{% url 'articles-list' %}">Gab's Notes</a> <a href="{% url 'articles-list' %}">Articles list</a>
| |
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a href="{% url 'drafts-list' %}">View drafts <span class="pill">{{ drafts_count }}</span></a> <a href="{% url 'drafts-list' %}">View drafts <span class="pill">{{ drafts_count }}</span></a>

View file

@ -1,5 +1,5 @@
{% load i18n %} {% load i18n %}
<p class="date"> <p class="metadata">
{% if article.published_at %} {% if article.published_at %}
<time datetime="{{ article.published_at|date:CUSTOM_ISO }}">{{ article.published_at|date }}</time> <time datetime="{{ article.published_at|date:CUSTOM_ISO }}">{{ article.published_at|date }}</time>
{% else %} {% else %}

View file

@ -1,5 +1,6 @@
from typing import Union from typing import Union
from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import F from django.db.models import F
@ -18,7 +19,9 @@ class ArticlesListView(generic.ListView):
def get_context_data(self, *, object_list=None, **kwargs): def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs) context = super().get_context_data(object_list=object_list, **kwargs)
context["title"] = "Articles" context["title_header"] = "Articles"
context["blog_title"] = settings.BLOG["title"]
context["blog_description"] = settings.BLOG["description"]
return context return context
@ -31,6 +34,9 @@ class DraftsListView(generic.ListView, LoginRequiredMixin):
def get_context_data(self, *, object_list=None, **kwargs): def get_context_data(self, *, object_list=None, **kwargs):
context = super().get_context_data(object_list=object_list, **kwargs) context = super().get_context_data(object_list=object_list, **kwargs)
context["title"] = "Drafts" context["title"] = "Drafts"
context["title_header"] = context["title"]
context["blog_title"] = settings.BLOG["title"]
context["blog_description"] = settings.BLOG["description"]
return context return context

View file

@ -174,7 +174,7 @@ AUTH_USER_MODEL = "articles.User"
BLOG = { BLOG = {
"title": "Gab's Notes", "title": "Gab's Notes",
"description": "My take on tech-related subjects (but not only)", "description": "My take on tech-related subjects (but not only).",
"base_url": os.getenv("BLOG_BASE_URL", "https://gabnotes.org/"), "base_url": os.getenv("BLOG_BASE_URL", "https://gabnotes.org/"),
"repo": { "repo": {
"commit_url": "https://git.sr.ht/~crocmagnon/blog/commit/{commit_sha}", "commit_url": "https://git.sr.ht/~crocmagnon/blog/commit/{commit_sha}",