Release articles in public domain through CC0 + refactor blog settings context processor

This commit is contained in:
Gabriel Augendre 2022-01-02 10:20:43 +01:00
parent dcbf22a5fa
commit 23b034f8ac
4 changed files with 34 additions and 18 deletions

View file

@ -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,
}

View file

@ -9,9 +9,9 @@
<meta name="color-scheme" content="light dark">
<meta name="theme-color" content="#F6F8FA" media="(prefers-color-scheme: light)">
<meta name="theme-color" content="#111111" media="(prefers-color-scheme: dark)">
<title>{% block title %}Home | {% endblock %}{{ blog_title }} by {{ blog_author }}</title>
<title>{% block title %}Home | {% endblock %}{{ blog.title }} by {{ blog.author }}</title>
{% block feed_link %}
<link rel="alternate" type="application/rss+xml" title="{{ blog_title }}" href="{% url 'complete-feed' %}">
<link rel="alternate" type="application/rss+xml" title="{{ blog.title }}" href="{% url 'complete-feed' %}">
{% endblock %}
{% include "articles/snippets/analytics_head.html" %}
{% include "articles/snippets/page_metadata.html" %}
@ -33,8 +33,8 @@
</head>
<body>
<header>
<h1>{{ blog_title }}</h1>
<p>{{ blog_description }}</p>
<h1>{{ blog.title }}</h1>
<p>{{ blog.description }}</p>
{% include "articles/snippets/navigation.html" %}
</header>
{% endspaceless %}
@ -50,14 +50,22 @@
<p>
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 <a href="{{ blog_repo_homepage }}">free software</a>.
This blog and all articles by Gabriel Augendre are licensed under the
<a href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0 International License</a>.
Code blocks by Gabriel Augendre are published as is and released
<a href="https://git.augendre.info/gaugendre/blog/src/branch/master/LICENSE">into the public domain</a>.<br>
Currently deployed version: <a href="{{ git_version_url }}">{{ git_version }}</a>.
{% if blog_status_url %}
Status of services can be found <a href="{{ blog_status_url }}">here</a>
The platform behind this blog is <a target="_blank" href="{{ blog.repo.homepage }}">free software</a>.
Articles are released into the public domain through the
<a rel="license noopener noreferrer"
target="_blank"
href="{{ blog.licenses.content.url }}">
{{ blog.licenses.content.name }}</a>.
Code blocks are released into the public domain through
<a rel="license"
target="_blank"
href="{{ blog.licenses.code.url }}">
{{ blog.licenses.code.name }}</a>.<br>
Currently deployed version:
<a target="_blank" href="{{ git_version_url }}">{{ git_version }}</a>.
{% if blog.status_url %}
Status of services can be found
<a target="_blank" href="{{ blog.status_url }}">here</a>.
{% endif %}
</p>
</footer>

View file

@ -4,7 +4,7 @@
<meta property="og:title" content="{{ article.title }}" />
<meta property="og:type" content="article">
<meta property="og:description" content="{{ article.get_description }}">
<meta property="og:site_name" content="{{ blog_title }}">
<meta property="og:site_name" content="{{ blog.title }}">
{% endif %}
{% if open_graph_image_url %}
<meta property="og:image" content="{{ open_graph_image_url }}">

View file

@ -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")