~crocmagnon/blog

bd938138a26f7c54e34d1237c8650c4ff877500f — Gabriel Augendre 19 days ago 5fbdf4c
Add link to deployed commit in footer
3 files changed, 13 insertions(+), 3 deletions(-)

M articles/context_processors.py
M articles/templates/articles/base.html
M blog/settings.py
M articles/context_processors.py => articles/context_processors.py +7 -2
@@ 1,3 1,5 @@
from django.conf import settings

from articles.models import Article, Page

IGNORED_PATHS = [


@@ 28,7 30,10 @@ def git_version(request):
        return {}
    try:
        with open("/app/.version") as f:
            version = f.read().strip()[:8]
            version = f.read().strip()
        url = settings.BLOG["repo"]["commit_url"].format(commit_sha=version)
        version = version[:8]
    except FileNotFoundError:
        version = "latest"
    return {"git_version": version}
        url = settings.BLOG["repo"]["log"]
    return {"git_version": version, "git_version_url": url}

M articles/templates/articles/base.html => articles/templates/articles/base.html +1 -1
@@ 50,7 50,7 @@
        <a href="http://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0 International License</a>.
        Code blocks by Gabriel Augendre are licensed under the
        <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU GENERAL PUBLIC LICENSE version 3</a>.<br>
        Currently deployed version: {{ git_version }}
        Currently deployed version: <a href="{{ git_version_url }}">{{ git_version }}</a>
    </p>
</footer>
</body>

M blog/settings.py => blog/settings.py +5 -0
@@ 176,6 176,11 @@ BLOG = {
    "title": "Gab's Notes",
    "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}",
        "homepage": "https://git.sr.ht/~crocmagnon/blog",
        "log": "https://git.sr.ht/~crocmagnon/blog/log",
    },
}

SHORTPIXEL_API_KEY = os.getenv("SHORTPIXEL_API_KEY")