Skip to content

Commit

Permalink
ADD custom footer block with build time
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaume Florez committed May 23, 2018
1 parent 42a000b commit 785f0f0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
26 changes: 26 additions & 0 deletions custom/main.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block footer %}
{% include "partials/footer.html" %}
<script>
// Get all afected elements (copyright)
var elements = document.getElementsByClassName("md-footer-copyright")
var locale = navigator.language || navigator.languages[0] || "en"
for(footer_idx=0; footer_idx< elements.length; footer_idx++){
var footer = elements[footer_idx]
footer_date=document.createElement("div")
// <OFFSET>minutes * 60 seconds * 1000 miliseconds * -1 local time
offset=new Date().getTimezoneOffset()*60*1000*-1
build_date=new Date("{{ build_date_utc }}").getTime()
build_date=new Date(build_date+offset)
if (locale == 'es' || locale == 'es_ES'){
build_text = 'Fecha última modificación: '
} else if (locale == 'ca' || locale == 'ca_ES') {
build_text = "Data d'última modificació: "
} else {
build_text = "Last build on: "
}
footer_date.innerHTML=build_text + build_date.getFullYear() + "-" + (build_date.getMonth()+1) + "-" + build_date.getDate() + " " + build_date.toLocaleTimeString(locale, {hourCycle:"h24", hour: "2-digit", minute: "2-digit",second: "2-digit"})
footer.appendChild(footer_date)
}
</script>
{% endblock %}
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ theme:
feature:
tabs: true
language: 'ca'
custom_dir: custom

markdown_extensions:
- admonition
Expand Down
1 change: 1 addition & 0 deletions mkdocs_es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ theme:
feature:
tabs: true
language: 'es'
custom_dir: custom

markdown_extensions:
- admonition
Expand Down

0 comments on commit 785f0f0

Please sign in to comment.