Skip to content

Commit ccf9fda

Browse files
committed
Document setting for source code links
1 parent 8d4d394 commit ccf9fda

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

docs/configuring.rst

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,26 @@ Miscellaneous options
221221
File-wide metadata
222222
==================
223223

224-
The following options can be used as :ref:`file-wide metadata
225-
<sphinx:metadata>`:
224+
The following features are confugured per file in :ref:`file-wide metadata
225+
<sphinx:metadata>`, but they could also be set for all files using
226+
:ref:`html_context <spinx:html_context>` setting.
227+
228+
Enable "Edit on ..." links
229+
--------------------------
230+
231+
To enable "Edit on GitHub" link, you can add ``github_url`` option to the
232+
metadata of specific page, or use ``html_context`` to make this option set
233+
for all pages.
234+
235+
For example:
236+
237+
.. code:: python
238+
239+
html_context = {
240+
'github_url': 'https://github.com/readthedocs/sphinx_rtd_theme'
241+
}
242+
243+
Note that such URLs are static.
226244

227245
.. confval:: github_url
228246

@@ -236,6 +254,19 @@ The following options can be used as :ref:`file-wide metadata
236254

237255
Force the :guilabel:`Edit on GitLab` button to use the configured URL.
238256

257+
To generate dynamic URLs, there exists a set of other options.
258+
259+
.. code:: python
260+
261+
html_context = {
262+
'display_github': True,
263+
# 'github_host': 'github.com',
264+
'github_user': 'readthedocs',
265+
'github_repo': 'sphinx_rtd_theme',
266+
'github_version': 'master/'
267+
}
268+
269+
239270
Other configuration
240271
===================
241272

0 commit comments

Comments
 (0)