Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e62f8a

Browse files
author
Adam Parkin
committed
Git sha in footer
1 parent 5b227d3 commit 4e62f8a

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Readme.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ The `clean` target of the `Makefile` also removes any previously built `codepend
4646
Instead of `s3cmd` (which is what the generated `Makefile` uses), I changed to use the
4747
[AWS CLI](https://aws.amazon.com/cli/) because A) it's better, and B) I already had it installed.
4848

49+
### Git SHA in Footer
50+
51+
I hacked together some stuff in `pelicanconf.py` to get the git SHA & throw it into a variable. This
52+
is then displayed in the page footer, which I find useful for sanity checking what revision is running.
53+
54+
### Github Corners Configurable Colour
55+
56+
Flex (the theme I use) has support for [Github Corners](https://github.com/tholman/github-corners),
57+
but the colour isn't configurable. I modified the theme to use a config value `GITHUB_CORNER_BG_COLOR`
58+
which sets the background colour of the github corners icon (in my config I set it to the same value
59+
as the BG colour of buttons from the theme).
60+
4961
## Hosting
5062

5163
As mentioned, I have the site set up in AWS. All the generated content goes into a [S3](https://aws.amazon.com/s3/) bucket,

pelicanconf.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
from __future__ import unicode_literals
88
from datetime import datetime
9+
import subprocess
10+
11+
12+
def get_git_sha():
13+
# shamefully stolen from: https://stackoverflow.com/a/21901260/808804
14+
return str(subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']), 'utf-8').strip()
915

1016
AUTHOR = 'Adam Parkin'
1117
SITENAME = 'The Codependent Codr'
@@ -78,3 +84,5 @@
7884
GITHUB_CORNER_BG_COLOR = '#d9411e'
7985

8086
ADD_THIS_ID = 'ra-5ac30fba879b9110'
87+
88+
GIT_SHA = get_git_sha()

theme/Flex/templates/base.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ <h1><a href="{{ SITEURL }}">{{ SITETITLE }}</a></h1>
180180
{% else %}
181181
{% include "partial/copyright.html" %}
182182
{% endif %}
183+
184+
{% if GIT_SHA %}
185+
<p>{{ GIT_SHA }}</p>
186+
{% endif %}
183187
</footer>
184188
</main>
185189

0 commit comments

Comments
 (0)