Form-based, self-changing github HTML page: is it possible?
August 28, 2022 12:12 PM   Subscribe

I've been setting up simple, fast Jekyll pages on github pages for a while, but I'm tired of editing them for people. Is it possible to host some sort of app on the repo itself, such that they can create a github account, login, and edit specific string or image variables via form?

I've dabbled in various copy-paste code situations (JS, PHP, Perl), but am not a real programmer, and I don't really understand the limitations and structure of "web-apps." I get the impression that it'd be possible to run an AJAX-ish thing in the browser, auth against github, and modify the repo. maybe the app has to be a separate repo, or branch?

Ideally it'd be form based, where the app has a few fields, either strings ("Latest news" etc), or if possible, media (via repo upload or linked URL I suppose). Then they click "save," and voila.

Possible?
posted by Jack Karaoke to Computers & Internet (7 answers total) 4 users marked this as a favorite
 
Best answer: There are a number of SAAS based static CMS’s that essentially put a front end on a git repo.
One I am familiar with is forestry.io, though I don’t have any experience actually using it.
posted by rockindata at 12:47 PM on August 28, 2022


Netlify is another. Content management for static-site generators or CMS for SSG is a search term that will help you.
posted by migurski at 2:31 PM on August 28, 2022


Response by poster: I'm somewhat familiar with CMS using various backends for data sources, but I guess the downside of any of these are the wide generalized scope of a typical CMS (I'd rather not even task anyone with learning an admin backend, knowing what a block or menu system is, etc), and the requirement to create a 2nd party account. If a github page could host code that modifies it's own or secondary repo, it uses one login, and won't be subject to the platform either disappearing, changing pricing structures, etc)

That said, if a very simple CMS with github integration and a free plan is the closest I'm gonna get, so be it.
posted by Jack Karaoke at 4:02 PM on August 28, 2022


As to your question of could you build a web app that had some forms that would then update GitHub content and trigger a new build? Absolutely you could. In addition to straight git-based commands, GitHub also has a very comprehensive API.

Because my brain works on the server side, I would probably build this as a flask app with a form, but it is almost certainly doable completely on the client side as well.
posted by rockindata at 3:07 AM on August 29, 2022


It is technically possible to do the thing you want to do, but it's very annoying (the code to commit to GitHub via the API is quite annoying, and I don't think you can do it via git APIs, because crossorigin stuff will break the https push transit protocol), and there's no turnkey solution that you can just copy and paste.

My impression is that this doesn't exist because people who have the skills to build something like this realize that the complexity is not worth it, and that there are other, better solutions to the same problem.
posted by wesleyac at 7:40 AM on August 29, 2022


I’ve done this for clients* by exposing the relevant text strings, image URLs and alts, etc in a separate YAML or JSON or JS file that’s just a friendly human-readable list.

Client signs into GitHub, goes to that page via bookmark, edits the file, clicks the big green “commit changes” button. Netlify kicks off a build, they check that the result isn’t broken, then carry on with their day.

It’s nice not to have a CMS and it’s pretty friendly. It’s also difficult for them to break things beyond what can be fixed with a manual undo on their side or git operations on my side.

* not all clients; they have to be a bit savvy and not tech-cursed
posted by sixswitch at 9:32 AM on August 29, 2022 [1 favorite]


I can't speak to the difficulty of implementing this yourself, but I believe TiddlyWiki does it: https://tiddlywiki.com/#Saving%20to%20a%20Git%20service
posted by sibilatorix at 2:56 PM on September 1, 2022


« Older Modern Greek classes in southern Westchester?   |   Better takeout dosa? Newer »
This thread is closed to new comments.