diff --git a/docs/_templates/layout.html b/docs/_templates/layout.html
index d9ec48194..e5b482464 100644
--- a/docs/_templates/layout.html
+++ b/docs/_templates/layout.html
@@ -1,13 +1,6 @@
{% extends "!layout.html" %}
{%- block extrahead %}
-
-
-
-
+
{{ super() }}
{% endblock %}
diff --git a/publish.py b/publish.py
index 526d2687c..fec64b1be 100755
--- a/publish.py
+++ b/publish.py
@@ -62,10 +62,32 @@ def run_html(args):
call('make FAIL_WARN=-W html', cwd=docs_dir)
+def add_analytics():
+ analytics = '''
+
+
+
+\
+'''
+ for dirpath, firnames, filenames in os.walk(publish_dir):
+ for fname in filenames:
+ if fname.endswith('.html'):
+ with open(os.path.join(dirpath, fname), 'r+b') as f:
+ html = f.read().decode('utf-8')
+ html = html.replace('', analytics, 1)
+ f.seek(0), f.truncate()
+ f.write(html.encode('utf-8'))
+
+
def run_website(args):
if os.path.exists(publish_dir):
shutil.rmtree(publish_dir)
shutil.copytree(os.path.join(docs_dir, '_build', 'html'), publish_dir)
+ add_analytics()
with open(os.path.join(publish_dir, 'current-version.txt'), 'w') as f:
f.write(version)
shutil.copy2(os.path.join(docs_dir, 'installer.sh'), publish_dir)