Skip to content
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

Fix edit button on Read the Docs with stable branch builds #668

Open
1 task done
pradyunsg opened this issue Jun 16, 2023 · 2 comments
Open
1 task done

Fix edit button on Read the Docs with stable branch builds #668

pradyunsg opened this issue Jun 16, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@pradyunsg
Copy link
Owner

pradyunsg commented Jun 16, 2023

What's happening?

The current logic for computing the GitHub URLs in Furo, when on RTD is:

{% set url = "https://github.com/" + github_user + "/" + github_repo + "/edit/" + github_version + conf_py_path + pagename + page_source_suffix %}

This differs from sphinx-rtd-theme (https://github.com/readthedocs/sphinx_rtd_theme/blob/9899ee4ee2f547f81e51297dc12317f018e62fdd/sphinx_rtd_theme/breadcrumbs.html#L39) and should be fixed to align with that.

Reproducer

  1. Build Sphinx documentation set on RTD, with a stable branch or tag.
  2. See the edit page button's URL -- it has the commit hash rather than the source ref.

Expectation

The generated URL should point to the source ref.

Code of Conduct

@matthewhughes934
Copy link

Is there anything blocking changing this? Is it as simple as updating the path you linked:

diff --git a/src/furo/theme/furo/components/edit-this-page.html b/src/furo/theme/furo/components/edit-this-page.html
index c61b17b..e8dc5f7 100644
--- a/src/furo/theme/furo/components/edit-this-page.html
+++ b/src/furo/theme/furo/components/edit-this-page.html
@@ -17,7 +17,7 @@
 {% block link_not_available %}
 {# Make nice things happen, on Read the Docs #}
 {%- if READTHEDOCS and conf_py_path and page_source_suffix and github_user != "None" and github_repo != "None" and github_version and pagename and page_source_suffix %}
-  {% set url = "https://github.com/" + github_user + "/" + github_repo + "/edit/" + github_version + conf_py_path + pagename + page_source_suffix %}
+  {% set url = "https://github.com/" + github_user + "/" + github_repo + "/blob/" + github_version + conf_py_path + pagename + page_source_suffix %}
   {{ furo_edit_button(url) }}
 {%- endif -%}
 {% endblock %}

@pradyunsg
Copy link
Owner Author

That is not gonna work since blob links are not what we wanna link to and those pages also don’t have an edit button. What we need to change to is linked inOP. It’s a matter of someone investigating and making the relevant changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants