Martin Ueding
Martin Ueding

Reputation: 8699

Common link targets in Sphinx

I have a lot of Sphinx pages which have the same links on them. Like those:

.. _CC-BY: https://creativecommons.org/licenses/by/3.0/
.. _MIT: http://opensource.org/licenses/MIT

Currently, I have those two lines in every file that has a MIT_ in it. Is it possible to have a central file in the project where I can put those link targets? That way, I could write MIT_ anywhere and it would link to that.

Upvotes: 5

Views: 439

Answers (1)

mzjn
mzjn

Reputation: 50947

Put your link definitions in rst_epilog in conf.py:

rst_epilog = """
.. _CC-BY: https://creativecommons.org/licenses/by/3.0/
.. _MIT: http://opensource.org/licenses/MIT
"""

Upvotes: 11

Related Questions