Repository: sunpy/sunpy

Issue:
Edit on GitHub link issues
<!-- This comments are hidden when you submit the issue so you do not need to remove them!
Please be sure to check out our contributing guidelines: https://github.com/sunpy/sunpy/blob/master/CONTRIBUTING.rst
Please be sure to check out our code of conduct:
https://github.com/sunpy/sunpy/blob/master/CODE_OF_CONDUCT.rst -->

<!-- Please have a search on our GitHub repository to see if a similar issue has already been posted.
If a similar issue is closed, have a quick look to see if you are satisfied by the resolution.
If not please go ahead and open an issue! -->

### Description
<!-- Provide a general description of the bug. -->
The edit on GitHub link from the docs is broken for a number of versions.
### Expected behavior
<!-- What did you expect to happen. -->
Click the link and be brought to the code on GitHub
### Actual behavior
<!-- What actually happened. -->
<!-- Was the output confusing or poorly described? -->
Error as link does not exist (sometimes)
### Steps to Reproduce
<!-- Ideally a code example could be provided so we can run it ourselves. -->
<!-- If you are pasting code, use tripe backticks (```) around your code snippet. -->

Pick you favourite documentation (e.g https://docs.sunpy.org/en/stable/api/sunpy.net.fido_factory.UnifiedResponse.html) click on on the 'edit on github' link. Change the version using the version box in the bottom right of the webpage.

| doc version  | link | status |
| ------------ | ----|------- |
| latest  | https://github.com/sunpy/sunpy/tree/master/sunpy/net/fido_factory.py#L31  | ok |
| stable  | https://github.com/sunpy/sunpy/tree/1.1.0/sunpy/net/fido_factory.py#L31 | broken |
| v1.1.0 | https://github.com/sunpy/sunpy/tree/1.1.0/sunpy/net/fido_factory.py#L31 | broken |
| v1.0.7 | https://github.com/sunpy/sunpy/tree/1.0.7/sunpy/net/fido_factory.py#L31 | broken |
| v0.9.9 | http://github.com/sunpy/sunpy/tree/0.9/sunpy/net/fido_factory.py#L30 | ok |
| v0.8.5 | http://github.com/sunpy/sunpy/tree/v0.8.x/sunpy/net/fido_factory.py#L29 | broken |

For `1.x.y` the url needs to be `.../tree/v1.x.y/...` but for the the `v0.8.5` the x in the url is the issue so `.../tree/0.8.5/...` works but only without the leading  'v'?

It's not a major issue just an annoyance especially for for the 1.1.0 docs.

Seem's like this line is the issue but not sure how to fix for both 1.x.y and 0.x.y maybe add an if?
https://github.com/sunpy/sunpy/blob/fe8ef2ec505d504cb2af52d90246529e8c5fb84f/docs/conf.py#L242



Discussion:
I thought I fixed this (I might have made it worse).

The issue is between the branch names and the tagged versions. 
We basically need to check if the version number is clean, if so probably add a "v" to the version number.

I don't think the 0.8.5 docs build anymore, so I am unsure that can be fixed (we should just turn it off). 

I know 0.8.5 isn't supported anymore but people may still use it don't think turning off the docs 0.8.5 docs would be ideal might not be worth fixing for 0.8.5 though. 
Hi @samaloney, is it okay if I take this up or are you on it already?
> I know 0.8.5 isn't supported anymore but people may still use it don't think turning off the docs 0.8.5 docs would be ideal might not be worth fixing for 0.8.5 though.

That's fair.
I think there might be built in support for this feature in sphinx now? At least whoever finds themselves looking into this should investigate if the extension we are using for this is the most appropriate way of doing it.
I wanna work on this but I am unable to understand what is the structure or type of the variable 'version' is?

I tried to backtrace and found this 
```
 from setuptools_scm import get_version
```
There is no file with the name setuptools_scm
`setuptools_scm` is a python library you would need to install. 
I wonder if "Edit on github" should always point to the master branch, as thats where the most up to date docs are, and if we want to update docs on an older release branch we typcially update the master branch and then do a backport.
I think it would be strange to specifically select a version (using the switcher in bottom right) but be brought to a different version of the source code but that could just be me?
Shouldn't the versions point to the tagged version instead of the branch? 

Do we even want to allow this in the first place?  I am not sure I see the purpose of `edit on GitHub`.

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -239,7 +239,7 @@ def rstjinja(app, docname, source):
 # "version" configuration parameter
 edit_on_github_project = "sunpy/sunpy"
 if 'dev' not in release:
-    edit_on_github_branch = f"{version}"
+    edit_on_github_branch = f"{version.split('.')[0]}.{version.split('.')[1]}"
 else:
     edit_on_github_branch = "master"
 edit_on_github_source_root = ""
diff --git a/sunpy/net/hek/hek.py b/sunpy/net/hek/hek.py
--- a/sunpy/net/hek/hek.py
+++ b/sunpy/net/hek/hek.py
@@ -19,7 +19,7 @@
 
 __all__ = ['HEKClient']
 
-DEFAULT_URL = 'http://www.lmsal.com/hek/her?'
+DEFAULT_URL = 'https://www.lmsal.com/hek/her?'
 
 
 def _freeze(obj):


Test patch: