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 · 6 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
@EvanBinu
Copy link

EvanBinu commented May 12, 2025

Hello @mlncn
I am interested in solving this issue.
Can you assign this to me.
Thank you

@mlncn
Copy link
Contributor Author

mlncn commented May 12, 2025

@EvanBinu i do not have the power to assign but i hope if you are able to add the code ReadTheDocs will merge it in!

@EvanBinu
Copy link

ok @mlncn
I will try adding the code.
Thank you

EvanBinu added a commit to EvanBinu/readthedocs.org that referenced this issue May 12, 2025
Edit Source link for Gitea, Forgejo, or other self-hosted online repository readthedocs#12117
@EvanBinu
Copy link

@mlncn
I have put a Pull Request.
Can you please review it.
Thank you.

@verisimilidude2
Copy link
Contributor

@ericholscher Take a look at this one during PyConUSA sprint

@ericholscher
Copy link
Member

ericholscher commented May 21, 2025

I looked at the PR here, and it seems more like theme documentation than RTD?

#12168 (review)

Honestly we should probably just delete the guide that we have, since it isn't actually adding value compared to the theme docs here.,

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

5 participants