From 11cc84b7b1a0ff60327185bad92c86dcefb0f6e1 Mon Sep 17 00:00:00 2001 From: thegreatyamori Date: Wed, 13 Oct 2021 21:33:42 -0500 Subject: [PATCH 1/3] add get_last_commit() --- conf.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index c39c3fad..114762f8 100644 --- a/conf.py +++ b/conf.py @@ -1,4 +1,5 @@ import os +import subprocess import time # !! This is the configuration of Nikola. !! # @@ -964,6 +965,7 @@

Comunidad Python Ecuador

+

Commit: {commit}

© {date} Todos los derechos reservados.

@@ -989,6 +991,11 @@ # still needs to be a dict of this format. (it can be empty if you # do not need formatting) # (translatable) +def get_last_commit(): + encoding = 'utf-8' + command = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True) + return command.stdout.decode(encoding) + CONTENT_FOOTER_FORMATS = { DEFAULT_LANG: ( (), @@ -996,7 +1003,8 @@ "email": BLOG_EMAIL, "author": BLOG_AUTHOR, "date": time.gmtime().tm_year, - "license": LICENSE + "license": LICENSE, + "commit": get_last_commit() } ) } From 036d3ee8abe8a78219a62037a07d33458cc1abaa Mon Sep 17 00:00:00 2001 From: thegreatyamori Date: Wed, 13 Oct 2021 21:48:00 -0500 Subject: [PATCH 2/3] convert hash to accesible link --- conf.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/conf.py b/conf.py index 114762f8..07bdf33d 100644 --- a/conf.py +++ b/conf.py @@ -965,14 +965,17 @@

Comunidad Python Ecuador

-

Commit: {commit}

© {date} Todos los derechos reservados. -

- - ¿Encontraste un error? - ¡Repórtalo! - -

+
+ + ¿Encontraste un error? + ¡Repórtalo! + +
+ + commit: + {commit} +
From 7f6ab4fffb6075fdd1c874f8ac9bd54d89ff8d55 Mon Sep 17 00:00:00 2001 From: thegreatyamori Date: Wed, 13 Oct 2021 22:06:23 -0500 Subject: [PATCH 3/3] slice the first 8 digits --- conf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/conf.py b/conf.py index 07bdf33d..2af38caf 100644 --- a/conf.py +++ b/conf.py @@ -997,7 +997,8 @@ def get_last_commit(): encoding = 'utf-8' command = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True) - return command.stdout.decode(encoding) + last_hash = command.stdout.decode(encoding) + return last_hash[0:8] CONTENT_FOOTER_FORMATS = { DEFAULT_LANG: (