diff --git a/doc/source/index.rst b/doc/source/index.rst index 55f20126..fdb3e041 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -78,6 +78,14 @@ Using the theme bug_project = '721' bug_tag = '' +#. Set the specific Git URL. + + ``giturl`` + The path to the ``source`` directory of the documentation at ``git.openstack.org``. + If the documentation doesn't locate in ``doc/source`` directory, this option should + be set. Otherwise, the default is + ``https://git.openstack.org/cgit/openstack/PROJECT_NAME/tree/doc/source/``. + #. Enable the "last-updated" information by setting the format for the timestamp:: diff --git a/openstackdocstheme/__init__.py b/openstackdocstheme/__init__.py index 8bded51d..9e0bc4d2 100644 --- a/openstackdocstheme/__init__.py +++ b/openstackdocstheme/__init__.py @@ -101,8 +101,11 @@ def _html_page_context(app, pagename, templatename, context, doctree): app.warn('Cannot get gitsha from git repository.') _html_context_data['gitsha'] = 'unknown' + giturl = app.config.giturl repo_name = app.config.repository_name - if repo_name: + if giturl: + _html_context_data['giturl'] = app.config.giturl + elif repo_name: _html_context_data['giturl'] = _giturl.format(repo_name) bug_project = app.config.bug_project if bug_project: @@ -124,6 +127,7 @@ def setup(app): app.add_config_value('repository_name', '', 'env') app.add_config_value('bug_project', '', 'env') app.add_config_value('bug_tag', '', 'env') + app.add_config_value('giturl', '', 'env') app.add_html_theme( 'openstackdocs', os.path.abspath(os.path.dirname(__file__)) + '/theme/openstackdocs', diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 2d5dc28c..a65afe4e 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -54,6 +54,7 @@ master_doc = 'index' # General information about the project. project = u'OpenStackdocstheme Release Notes' copyright = u'2017, OpenStack Documentation team' +giturl = u'https://git.openstack.org/cgit/openstack/openstackdocstheme/tree/releasenotes/source' # Release notes are version independent. # The full version, including alpha/beta/rc tags.