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 typing import Any
from django.conf import settings 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]: def blog_metadata(request: HttpRequest) -> dict[str, Any]:
blog_settings = copy.deepcopy(settings.BLOG)
return { return {
"blog_title": settings.BLOG["title"], "blog": blog_settings,
"blog_description": settings.BLOG["description"],
"blog_author": settings.BLOG["author"],
"blog_repo_homepage": settings.BLOG["repo"]["homepage"],
"blog_status_url": settings.BLOG["status_url"],
} }

View file

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

View file

@ -4,7 +4,7 @@
<meta property="og:title" content="{{ article.title }}" /> <meta property="og:title" content="{{ article.title }}" />
<meta property="og:type" content="article"> <meta property="og:type" content="article">
<meta property="og:description" content="{{ article.get_description }}"> <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 %} {% endif %}
{% if open_graph_image_url %} {% if open_graph_image_url %}
<meta property="og:image" content="{{ 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", "log": "https://git.augendre.info/gaugendre/blog/commits/branch/master",
}, },
"status_url": env("SERVICES_STATUS_URL"), "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") SHORTPIXEL_API_KEY = env("SHORTPIXEL_API_KEY")