Closed BryanQuigley closed 1 year ago
Great idea @jackgilmore! Agree it makes sense to have this upstream. Thanks for adding it in @BryanQuigley. Just wanted to flag that there's an alternative way to generate the link that (a) doesn't require users set the repo
in _config.yml
when installing, and (b) handles cases where gh-pages
is not the primary branch.
Jekyll sites built on GitHub pages are built with a set of plugins, including github-metadata, which comes with a liquid helper to generate a github edit link. This lets you do:
<a href="{% github_edit_link %}">Open in GitHub</a>
The only thing is that helper would probably fail to run locally without that gem installed, so we'd need to add the github-pages gem to the Gemfile, which we should have done ages ago, as it provides much greater dev-prod parity.
I've just tested this out locally, and it seems to work, so I'll push it up to save you the trouble. Let me know what you think.
Awesome! Glad this was of help and thanks for passing on that bit of knowledge about an easier way to implement the help link. Think I'll be adding in a PR on our JKAN instance to implement this downstream!
Credit for this goes to JackGilmore in https://github.com/OpenDataScotland/jkan/commit/641bd10b7abf00a1677ff91cc3ff32f126b26955#diff-45a9a1193a7cfd87edb43c63db091a0737180f026c74dd2c08280e6ced090ab4