jekyll / jekyll-admin

A Jekyll plugin that provides users with a traditional CMS-style graphical interface to author content and administer Jekyll sites.
https://jekyll.github.io/jekyll-admin/
MIT License
2.82k stars 357 forks source link

Git Gateway Support #608

Closed HeyITGuyFixIt closed 3 years ago

HeyITGuyFixIt commented 3 years ago

I've noticed a few issues related to publishing (#75) and connecting to GitHub (#414). My website is built with Jekyll, stored on GitLab and hosted on Netlify. I currently use NetlifyCMS for managing blog posts, but it is too limited for managing the entire site. NetlifyCMS connects to GitLab (and other Git sites) through Netlify's Git Gateway. Integrating Git Gateway could be a solution for the mentioned issues about publishing.

It appears to be possible to use Git Gateway without Netlify, but using Netlify makes it easy for the user. It uses Netlify's Identify feature or can use a GoTrue instance (which is the heart of Netlify's Identity feature) for authentication.

From what I can tell, Git Gateway allows tools to use the endpoints /.netlify/git/github/ for GitHub and /.netlify/git/gitlab/repository/ for Gitlab. These are equivalent to GitHub's https://api.github.com/repos/your-user/your-repository/ and Gitlab's https://gitlab.com/api/v4/projects/your-user%2Fyour-repository/ endpoints.

These are the sub endpoints that they give us access to:

for GitHub:

/repos/:owner/:name/git/
/repos/:owner/:name/contents/
/repos/:owner/:name/pulls/
/repos/:owner/:name/branches/

for GitLab:

/repos/:owner/:name/files/
/repos/:owner/:name/commits/
/repos/:owner/:name/tree/

So, for GitHub, we can use git, contents, pulls and branches, which would be appended to Git Gateway's GitHub endpoint that they provide. Likewise, for Gitlab, we can use files, commits, and tree, which would be appended to Git Gateway's Gitlab endpoint that they provide. GitHub and Gitlab's APIs should still apply but with these endpoints, within the limitations of Git Gateway.

I think this would be worth looking into and integrating into Jekyll Admin. As I explore Jekyll Admin and its source code, I may be able to provide some help where I can.

mertkahyaoglu commented 3 years ago

Hi @HeyITGuyFixIt. Thanks for letting us know about this. But as far as I understand, Git Gateway provides a separate admin panel through Netlify (Netlify CMS), right? So it does what Jekyll Admin tries to do but in the cloud. If that's true, I don't think it would be suitable to integrate with Jekyll Admin. It may be better to have a standalone project for this, more like an integration with Jekyll itself. I really liked the idea. We could introduce this in Jekyll main repo and see what the community will think about it.

HeyITGuyFixIt commented 3 years ago

@mertkahyaoglu To clarify, NetlifyCMS is the admin panel, much like I understand Jekyll Admin to be. It uses Git Gateway as a backend to communicate with GitHub and Gitlab. Git Gateway can be used without NetlifyCMS, but with other projects.

thiagovilla commented 3 years ago

So the idea is we keep Jekyll Admin but save directly to a repo via git?

i-a-n commented 3 years ago

I like the idea of integrating with git. I looked into integrating Git Gateway a while back, and decided against personally attempting it for a couple of reasons. One, I chose jekyll-admin because of its simplicity, and running an identity/auth server requires much more administration than I'm interested in. Mapping auth levels, resetting passwords, etc, was what I was trying to avoid by choosing jekyll-admin and just using an .htpasswd file. Two, jekyll-admin has no integration with external fileservers, so every uploaded image or file, including deleting, renaming or moving them, would trigger a git action, which I thought would be way too much noise in an average git repo. And lastly, the jekyll-admin team is much smaller and less active than Netlify.. so the maintenance of this feature would probably be spotty, and if I'm being honest, there's a better chance NetlifyCMS would fix a problem—or add a missing feature that made me choose jekyll-admin—than this major feature being completed and well supported.

Having said that, I do think git integration would be a huge win for jekyll-admin, but I was imagining something much more simple. @HeyITGuyFixIt, might I ask why you were interested in git integration to begin with? For me, I just want to have a central, incrementalized backup location. As a result:

If these types of UX ideas would fit your use-case, and maybe other contributors' use-cases, this could be quite a bit simpler to design and implement. Perhaps the working directory could simply be set up to commit to a git repo, and jekyll-admin alerted to this fact with a config option. And I'll be happy to work on the core components of that.

I don't want to hijack a thread about Git Gateway though, so if this idea isn't a good fit I can open another one in the future.

HeyITGuyFixIt commented 3 years ago

@i-a-n my use case is, I have the code for my website stored on Gitlab, and it is built with Jekyll and served through Netlify. A solution such as Jekyll Admin could potentially allow for a user interface to manage the site, aside from manually editing the code like I usually do. I personally am okay with doing this manually, but I would like the ability to allow others to edit the site, who don't know how to code.

The site is completely stored on Gitlab, so any edits made would need to be made through git to Gitlab. With the way Netlify works with Jekyll, it listens for changes made to the repository and rebuilds and serves the site everytime.

jekyllbot commented 3 years ago

This issue has been automatically marked as stale because it has not been commented on for at least two months.

The resources of the Jekyll team are limited, and so we are asking for your help.

If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.

If this is a feature request, please consider whether it can be accomplished in another way. If it cannot, please elaborate on why it is core to this project and why you feel more than 80% of users would find this beneficial.

This issue will automatically be closed in two months if no further activity occurs. Thank you for all your contributions.