diff --git a/changelogs/fragments/plugin_doc_link_fix.yml b/changelogs/fragments/plugin_doc_link_fix.yml new file mode 100644 index 00000000000..b68264b688c --- /dev/null +++ b/changelogs/fragments/plugin_doc_link_fix.yml @@ -0,0 +1,2 @@ +minor_changes: +- "'Edit on GitHub' link for plugin, cli documentation fixed to navigate to correct plugin, cli source." diff --git a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html index 7dcdeb34b26..ada446b42f7 100644 --- a/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html +++ b/docs/docsite/_themes/sphinx_rtd_theme/breadcrumbs.html @@ -46,6 +46,10 @@ {% if pagename.endswith('_module') %} {{ _('Edit on GitHub') }} + {% elif pagename.startswith('plugins') and meta.get('source', None) %} + {{ _('Edit on GitHub') }} + {% elif pagename.startswith('cli') and meta.get('source', None) %} + {{ _('Edit on GitHub') }} {% elif (not 'list_of' in pagename) and (not 'category' in pagename) %} {{ _('Edit on GitHub') }} {% endif %} diff --git a/docs/docsite/rst/conf.py b/docs/docsite/rst/conf.py index b7adbd40ea9..e9d6699c15d 100644 --- a/docs/docsite/rst/conf.py +++ b/docs/docsite/rst/conf.py @@ -142,6 +142,8 @@ html_context = { 'github_repo': 'ansible', 'github_version': 'devel/docs/docsite/rst/', 'github_module_version': 'devel/lib/ansible/modules/', + 'github_root_dir': 'devel/lib/ansible', + 'github_cli_version': 'devel/lib/ansible/cli/', 'current_version': version, 'latest_version': '2.9', # list specifically out of order to make latest work diff --git a/docs/templates/cli_rst.j2 b/docs/templates/cli_rst.j2 index 824843d86bb..0e4c0f16831 100644 --- a/docs/templates/cli_rst.j2 +++ b/docs/templates/cli_rst.j2 @@ -1,3 +1,5 @@ +:source: {{ cli }}.py + {% set name = cli_name -%} {% set name_slug = cli_name -%}