Skip to content

Edit Source link for Gitea, Forgejo, or other self-hosted online repository #12117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mlncn opened this issue Apr 16, 2025 · 0 comments
Open
Labels
Needed: documentation Documentation is required

Comments

@mlncn
Copy link
Contributor

mlncn commented Apr 16, 2025

What's the problem this feature will solve?

All code with repository hosting that supports online editing does not have to be on GitHub, GitLab / self-hosted GitLab, or Bitbucket. Gitea, Forgejo, and others exist and are increasingly popular.

Describe the solution you'd like

Extend the options documented on https://docs.readthedocs.com/platform/stable/guides/edit-source-links-sphinx.html to include "Other" with a display_repo setting that takes uses the following variables:

  • repo_host
  • repo_user (or org)
  • repo_slug (repository name as seen in the URL)
  • repo_version (branch)
  • conf_src_path (to take the place of hard-coded /src/ and /blob path segments for our flexible custom repo)

The existing variable would still be used:

  • conf_py_path (appears right before pagename, defaults to /)
  • suffix
  • and of course the key one that changes for each page of the docs, pagename
{% if display_repo %}
    <a href="https://{{ repo_host|default("codeberg.org") }}/
    {{ repo_user }}/{{ repo_slug  }}{{ conf_src_path|default("/src/branch") }}{{ repo_version }}
    {{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-git-alt">
    Edit Source</a>
{% endif %}

Alternative solutions

Override default templates, but it is time to support open projects as at least second-class citizens.

Additional context

Pointers for where to add this / how many default themes are supported that should get the above added to their templates would be greatly appreciated.

@humitos humitos added the Needed: documentation Documentation is required label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needed: documentation Documentation is required
Projects
None yet
Development

No branches or pull requests

2 participants