From 23b034f8ac30b19f61baac17a19e3d9e559032e4 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sun, 2 Jan 2022 10:20:43 +0100 Subject: [PATCH] Release articles in public domain through CC0 + refactor blog settings context processor --- src/articles/context_processors.py | 8 ++--- src/articles/templates/articles/base.html | 32 ++++++++++++------- .../articles/snippets/page_metadata.html | 2 +- src/blog/settings.py | 10 ++++++ 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/articles/context_processors.py b/src/articles/context_processors.py index dd286f4..f567618 100644 --- a/src/articles/context_processors.py +++ b/src/articles/context_processors.py @@ -1,3 +1,4 @@ +import copy from typing import Any from django.conf import settings @@ -56,10 +57,7 @@ def open_graph_image_url(request: HttpRequest) -> dict[str, Any]: def blog_metadata(request: HttpRequest) -> dict[str, Any]: + blog_settings = copy.deepcopy(settings.BLOG) return { - "blog_title": settings.BLOG["title"], - "blog_description": settings.BLOG["description"], - "blog_author": settings.BLOG["author"], - "blog_repo_homepage": settings.BLOG["repo"]["homepage"], - "blog_status_url": settings.BLOG["status_url"], + "blog": blog_settings, } diff --git a/src/articles/templates/articles/base.html b/src/articles/templates/articles/base.html index 533879c..3d37340 100644 --- a/src/articles/templates/articles/base.html +++ b/src/articles/templates/articles/base.html @@ -9,9 +9,9 @@ - {% block title %}Home | {% endblock %}{{ blog_title }} by {{ blog_author }} + {% block title %}Home | {% endblock %}{{ blog.title }} by {{ blog.author }} {% block feed_link %} - + {% endblock %} {% include "articles/snippets/analytics_head.html" %} {% include "articles/snippets/page_metadata.html" %} @@ -33,8 +33,8 @@
-

{{ blog_title }}

-

{{ blog_description }}

+

{{ blog.title }}

+

{{ blog.description }}

{% include "articles/snippets/navigation.html" %}
{% endspaceless %} @@ -50,14 +50,22 @@

Thoughts written here are my own and don't reflect any of my past, present or future employer's position. - The platform behind this blog is free software. - This blog and all articles by Gabriel Augendre are licensed under the - CC BY-SA 4.0 International License. - Code blocks by Gabriel Augendre are published as is and released - into the public domain.
- Currently deployed version: {{ git_version }}. - {% if blog_status_url %} - Status of services can be found here + The platform behind this blog is free software. + Articles are released into the public domain through the + + {{ blog.licenses.content.name }}. + Code blocks are released into the public domain through + + {{ blog.licenses.code.name }}.
+ Currently deployed version: + {{ git_version }}. + {% if blog.status_url %} + Status of services can be found + here. {% endif %}

diff --git a/src/articles/templates/articles/snippets/page_metadata.html b/src/articles/templates/articles/snippets/page_metadata.html index 0acbd47..4f480d5 100644 --- a/src/articles/templates/articles/snippets/page_metadata.html +++ b/src/articles/templates/articles/snippets/page_metadata.html @@ -4,7 +4,7 @@ - + {% endif %} {% if open_graph_image_url %} diff --git a/src/blog/settings.py b/src/blog/settings.py index 5d3c634..fe02c93 100644 --- a/src/blog/settings.py +++ b/src/blog/settings.py @@ -224,6 +224,16 @@ BLOG = { "log": "https://git.augendre.info/gaugendre/blog/commits/branch/master", }, "status_url": env("SERVICES_STATUS_URL"), + "licenses": { + "content": { + "url": "https://creativecommons.org/publicdomain/zero/1.0/?ref=chooser-v1", + "name": "CC0 1.0", + }, + "code": { + "url": "https://git.augendre.info/gaugendre/blog/src/branch/master/LICENSE", + "name": "The Unlicense", + }, + }, } SHORTPIXEL_API_KEY = env("SHORTPIXEL_API_KEY")