Working as a team on a Kirby website

Hello,

i try to fiddling out a idea how to work as a team of writers and developers on a kirby website.
there should be a kind of staging server between the live site and the dev site.
But there are also changes on the live site… e.g. comments and ratings.

Does anyone have a idea how to fullfill this task?

Here is a nice article… bit nothing of that will help me, IMHO.

best regards,
Svnt

I work on a couple of sites with multiple authors, some of which clients have access to. You will always have the problem of two people potentially editing the same article at the same time. I don’t think theres a way to prevent that. Heres my workflow:

Scenario one

2 or more developers need to work on a site

Solution:

NEVER edit via the panel on the live site. Use Git and local servers (Vagrant, MAMP, Valet etc) to keep track of content changes and handle difference. Commit after changing a page. Pull when you start work. It’s that simple. It’s possible these days to deploy automatically with Git (Plesk and cPanel can do this). Failing that, you can push your changes to live or staging automatically via rSync or Git hooks.

Scenario two

2 or more developers need to work on a site locally + Client has access to live site panel to make changes.

Solution:

Same as the above solution but extend the rSync rule so that it can pull the content folder in the other direction from live site to local. This will sync up your changes. I do it manually but you can probably tie it into a Git hook or an NPM script.

A useful plugin is Kirby Logger. This will tell you who the last person to change a piece of content was. (I don’t use this plugin, but it might be useful to you).

This is purely the way I work, and it works for me.

There’s also the Auto Git plugin that commits changes on live site automatically to your repo. I’d actually separate content from the rest of the site for that purpose. Kirby Logger was only created for websites that don’t use Git, to track who made changes.

I use this plugin so if a user tries to edit a article already opened by another user a notification appears:

Sure, but Git won’t necessarily track a change made by a non-technical client who only has panel access, so I think its potentially still useful?

The Auto-Git plugin tracks changes to the content folder only, but with user names attached. But if you mean a non-technical user would not be able to view such changes, then yes, that’s right. A Panel widget to view such changes in the Panel was planned at one time, but so far never implemented. But as I said above, I created the Kirby Logger plugin mainly as an alternative to Auto-Git for people who can’t or don’t want to use version control. So yes, it is still useful, I think.

Ok, thank you for all the input.

So… my plan so far:

1 Live server: with the kirby website + GIT plugin but without Panel
1 ‘inhouse’ Staging server with the website that also is the GIT repo and with Panel

1.) all editors/developers edit content/code on the inhouse staging server… GIT will keep track of all changes
2.) content/code will be pulled from the live site… if a webhook is called? (a button pressed… maybe not possible due the lack of panel on the live server…hmm)
3.) live site pushes changes to the staging server e.g. comments id content changed… user commented a article.

is 2.) and 3.) possible with @pedroborges AUTO-GIT plugin?

Svnt

The Auto-Git plugin relies on Panel events; if you don’t install the Panel on the live server, you will have to trigger those events in your comment handling script.

if this is possible… great!

Yes, that’s possible with $kirby->trigger($event, $args = null)

1 Like

To prevent the event to be fired two times i have to check for the panel like this? -> Check if it is panel

Why should the event fire twice if you don’t use the Panel?

Because the staging server does have the panel and the same codebase than the live server.

Yes, but I don’t think the events would interfere. Let’s say you make a change via the Panel, panel fires event as it should. If you make a change on the frontend, frontend script fires event as it should. Both Panel and frontend events only fire if a change occurs. But of course you could check if the Panel exists, wouldn’t do any harm, just don’t think it’s necessary unless I am missing something :thinking:

1 Like

You can call Auto Git directly and even add new types of messages:

// Just call it from the logic to add comments
// after the content text file have been updated
autogit()->save('page.comment', $page->uri());

autogit()->save('page.rating', $page->uri());

Then use the autogit.translation option:

c::set('autogit.translation', [
    'site.update'  => 'Changed site options',
    'page.create'  => 'Created page %s',
    'page.update'  => 'Updated page %s',
    'page.delete'  => 'Deleted page %s',
    'page.sort'    => 'Sorted page %s',
    'page.hide'    => 'Hid page %s',
    'page.move'    => 'Moved page %1$s to %2$s',
+   'page.comment' => 'Comment added to page %s',
+   'page.rating'  => 'Rated page %s',
    'file.upload'  => 'Uploaded file %s',
    'file.replace' => 'Replaced file %s',
    'file.rename'  => 'Renamed file %s',
    'file.update'  => 'Updated file %s',
    'file.sort'    => 'Sorted file %s',
    'file.delete'  => 'Deleted file %s',
]);
2 Likes