site
site copied to clipboard
feat: Edit on GitHub button for content articles
Please don't review this yet :grin:
PR body
Supersedes #623 and #506 Closes #459
This PR adds an 'Edit on GitHub' button on the top right of content articles which links to the corresponding page source URL on the site repository on GitHub. This only shows up on articles (and those with sub-articles) and not categories. Apart from that this differs to the original implementation (in #506) in that it uses the relative path URL, and replaces the prefix (/pages/ part) with the GitHub repository source URL link and adds an .md. The hardcoded file name extension might be fixed when the source URL is grabbed when adding template context in pages.
I'll add a screenshot here soonish
PR status
- Does it work? yup, just that it shows up in the guides list too. It should only show on articles, not categories, and ^ that is the only category that doesn't work from what I tested.
- In terms of UI: can and should be improved
- Tests: will add some soon:tm:
todo
- [ ] Put
src_urlin page template context instead of using template filter - [ ] ...which would fix the button showing up in guides
- [ ] Fix GitHub icon
- [ ] Sizing and position
- [ ] Maybe add some tests
- [ ] Maybe not hardcoded GitHub prefix URL
Deploy Preview for pydis-static ready!
| Name | Link |
|---|---|
| Latest commit | a700e8b0df74cd7134069d9dc8902a0624f213af |
| Latest deploy log | https://app.netlify.com/sites/pydis-static/deploys/635c93d9f6c060000707a5ed |
| Deploy Preview | https://deploy-preview-626--pydis-static.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
Coverage remained the same at 100.0% when pulling a700e8b0df74cd7134069d9dc8902a0624f213af on hedyhli:feat/edit-gh into 5c23e35dfe4f934722fe680298b7a3bdd3bc5447 on python-discord:main.
@hedyhli Greetings. What's the status of this PR? Thanks!
Hi Xithrius! Unfortunately I've been pretty busy with school lately. I'd love to continue working on it though but I can't guarantee when I'll have time for it, hopefully before the end of April by the latest.
@hedyhli Greetings. What is your status on this PR?
Thanks!
Finally found some free time which fingers crossed might last until as much as the end of the year! So I'll be working on this for the coming weeks. Actually I have already resumed on this, but I have to set up my dev environment all over again and had some problems with docker the last time I tried (honestly I can't even remember if I used the docker setup last year).
Marking this as ready for review, feedback welcome!
Very good.
Any thoughts on how the behaviour on mobile could be improved?
It should wrap so the whole thing is to the next line, like I mentioned in the description. Either same line as sub-articles or each one their own line.
At the moment sub-articles seems to be wrapping to fit on the same line as the title. I doubt this works when title is longer (for pages other than the contributing index page) even before adding the edit on github like, so it would probably be best to have them both take their own line before the title.
I’ll experiment with what can be done, thanks!
Hi @hedyhli, were you able to find some possible fix for mobile? If it's too much of a hassle I believe we should also just be able to skip adding the edit button on mobile outright, as it's probably much less used than on desktop.
I have opened a PR at https://github.com/python-discord/site/pull/626 that has your commits to allow maintainer edits to get the final changes in to merge it.
Sad I didn’t get time to work on this, but thanks a lot for continuing on my progress!
Thanks for laying the foundation with your work! I am looking forward to having this on the live site.