~crocmagnon/blog

698a2db6a78daea02449fff8ed401e36f5034faa — Gabriel Augendre a month ago bd93813 master
Update articles list look with blog title and description
M articles/static/style.css => articles/static/style.css +5 -4
@@ 12,6 12,7 @@
    --error-text: #721c24;
    --warning-background: #fff3cd;
    --warning-text: #856404;
    --description-margin: .2rem;
}

html {


@@ 71,16 72,16 @@ a {
    margin-top: 4em;
}

.article-list h2, .article-detail h1 {
    margin-bottom: .2em;
.article-list h2, h1 {
    margin-bottom: var(--description-margin);
}

.article-detail h1 {
    font-size: 2em;
}

.date {
    margin-top: .2em;
.metadata {
    margin-top: var(--description-margin);
    color: var(--main2);
}


M articles/templates/articles/article_list.html => articles/templates/articles/article_list.html +3 -2
@@ 1,10 1,11 @@
{% extends 'articles/base.html' %}

{% block title %}
    {{ title }}
    {{ title_header }}
{% endblock %}
{% 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 %}
        <article class="article-list">
            <h2><a href="{% url 'article-detail' slug=article.slug %}">{{ article.title }}</a></h2>

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

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

M articles/views/html.py => articles/views/html.py +7 -1
@@ 1,5 1,6 @@
from typing import Union

from django.conf import settings
from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin
from django.db.models import F


@@ 18,7 19,9 @@ class ArticlesListView(generic.ListView):

    def get_context_data(self, *, object_list=None, **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




@@ 31,6 34,9 @@ class DraftsListView(generic.ListView, LoginRequiredMixin):
    def get_context_data(self, *, object_list=None, **kwargs):
        context = super().get_context_data(object_list=object_list, **kwargs)
        context["title"] = "Drafts"
        context["title_header"] = context["title"]
        context["blog_title"] = settings.BLOG["title"]
        context["blog_description"] = settings.BLOG["description"]
        return context



M blog/settings.py => blog/settings.py +1 -1
@@ 174,7 174,7 @@ AUTH_USER_MODEL = "articles.User"

BLOG = {
    "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/"),
    "repo": {
        "commit_url": "https://git.sr.ht/~crocmagnon/blog/commit/{commit_sha}",