Sphinx theme for RST-sourced documentation published to docs.openstack.org
Go to file
Cory Benfield 89b0475539 Make Google Analytics tracking optional.
Some OpenStack contributors have expressed concern about having Google
Analytics tracking codes embedded in all of the HTML documentation
generated by the use of this theme. In addition to these concerns, which
mostly focus on privacy, having the Google Analytics tracking code used
widely runs the risk of creating misleading analytics data.

This change adopts an approach used by the Alabaster theme, which
enables Google Analytics tracking to be optional. Tracking is now
controlled by the theme settings in conf.py using a new theme option,
'analytics_tracking_code'. If present, this causes the HTML to include
the analytics tracking, with the provided code being used. If not
present, the Google Analytics snippet is excluded from the
documentation.

To avoid breakage, this commit uses the current hard-coded Google
Analytics tracking code as the default value of the option, which
means that most users will not notice any change and may continue to be
accidentally opted in to Google Analytics tracking.

Change-Id: I156151c3f458931f13716b4a32087afe57483794
2015-12-05 07:45:26 +00:00
doc/source Update log-a-bug comments 2015-10-06 14:01:11 +02:00
openstackdocstheme Make Google Analytics tracking optional. 2015-12-05 07:45:26 +00:00
releasenotes Make Google Analytics tracking optional. 2015-12-05 07:45:26 +00:00
.gitignore Add reno for release-notes 2015-11-10 08:37:48 +01:00
.gitreview add a .gitreview file 2015-02-03 12:28:09 -05:00
CONTRIBUTING.rst Adds rearranged files for rename to openstackdocstheme 2015-01-28 13:56:35 -06:00
HACKING.rst Adds rearranged files for rename to openstackdocstheme 2015-01-28 13:56:35 -06:00
index.rst Adds working links to navigation dropdown and column 2015-01-28 10:16:40 -06:00
LICENSE Adds rearranged files for rename to openstackdocstheme 2015-01-28 13:56:35 -06:00
Makefile Starting point for Sphinx theme for docs.openstack.org content 2015-01-20 10:49:21 -06:00
README.rst Merge "Use os.getcwd() instead of shelling out to run pwd" 2015-05-26 00:37:31 +00:00
RELEASENOTES.rst Update RELEASENOTES for 1.2.4 release 2015-10-12 12:34:17 +02:00
requirements.txt Adds rearranged files for rename to openstackdocstheme 2015-01-28 13:56:35 -06:00
setup.cfg Merge branch 'master' of https://github.com/annegentle/openstackdocstheme 2015-01-28 14:01:32 -06:00
setup.py Adds rearranged files for rename to openstackdocstheme 2015-01-28 13:56:35 -06:00
test-requirements.txt Add reno for release-notes 2015-11-10 08:37:48 +01:00
tox.ini Add -W to sphinx invocation for release-notes build 2015-11-25 19:48:17 +01:00

OpenStack docs.openstack.org Sphinx Theme

Theme and extension support for Sphinx documentation that is published to docs.openstack.org. Intended for use by OpenStack projects.

Using the Theme

Prior to using this theme, ensure your project can use the OpenStack brand by referring to the brand guidelines at http://www.openstack.org/brand.

Update the requirements list for your project to include openstackdocstheme (usually in test-requirements.txt).

If your project previously used the oslosphinx theme (without modifying the header navigation), remove oslosphinx from your requirements list, and then in your conf.py you can remove the import statement and extension listing for oslosphinx.

Some of the settings below are included in the file generated by Sphinx when you initialize a project, so they may already have values that need to be changed.

Then modify your Sphinx settings in conf.py to include:

import openstackdocstheme

html_theme = 'openstackdocs'
html_theme_path = [openstackdocstheme.get_html_theme_path()]

Also, you must include these variables so that the "Log a bug" link sends metadata for the project where the docs reside:

# We ask git for the SHA checksum
# The git SHA checksum is used by "log-a-bug"
git_cmd = "/usr/bin/git log | head -n1 | cut -f2 -d' '"
gitsha = os.popen(git_cmd).read().strip('\n')
# tag that reported bugs will be tagged with
bug_tag = "your-chosen-tag"
# source tree
pwd = os.getcwd()
# html_context allows us to pass arbitrary values into the html template
html_context = {"pwd": pwd, "gitsha": gitsha}
# Must set this variable to include year, month, day, hours, and minutes.
html_last_updated_fmt = '%Y-%m-%d %H:%M'