Skip to content

Commit 65d2ec5

Browse files
thegreatyamoristsewd
authored andcommitted
add get_last_commit()
1 parent 922f95f commit 65d2ec5

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import subprocess
23
import time
34

45
# !! This is the configuration of Nikola. !! #
@@ -964,6 +965,7 @@
964965
<div class="row text-center">
965966
<div class="col">
966967
<p>Comunidad Python Ecuador</p>
968+
<p>Commit: {commit}</p>
967969
<small>© {date} Todos los derechos reservados.</small>
968970
<p>
969971
<small>
@@ -989,14 +991,20 @@
989991
# still needs to be a dict of this format. (it can be empty if you
990992
# do not need formatting)
991993
# (translatable)
994+
def get_last_commit():
995+
encoding = 'utf-8'
996+
command = subprocess.run(["git", "rev-parse", "HEAD"], capture_output=True)
997+
return command.stdout.decode(encoding)
998+
992999
CONTENT_FOOTER_FORMATS = {
9931000
DEFAULT_LANG: (
9941001
(),
9951002
{
9961003
"email": BLOG_EMAIL,
9971004
"author": BLOG_AUTHOR,
9981005
"date": time.gmtime().tm_year,
999-
"license": LICENSE
1006+
"license": LICENSE,
1007+
"commit": get_last_commit()
10001008
}
10011009
)
10021010
}

0 commit comments

Comments
 (0)