Revisions support

I’ve started already.

Head file?

When using visible/order on pages it will look like this in the revisions folder:

parent/1-child/2016-01-01@01-01-01/default.txt
parent/2-child/2016-01-01@01-01-02/default.txt
parent/3-child/2016-01-01@01-01-03/default.txt

All of the folders are in fact the same page but I have change the order. It means three different page folders for only one page. (1-child, 2-child, 3-child)

I could try to recursively delete all except the current one on every save, but I have another idea. Create a head.txt file.

Folder without order number and template name

One folder with two files:

parent/child/2016-01-01@01-01-01/head.txt
parent/child/2016-01-01@01-01-01/content.txt

Inside head.txt:

sort: 3
template: default
language: en

Inside content.txt it would just be the content, a copy of default.txt in this case from the content folder.

Benefits

  • I don’t need to delete or move around folders and files very much. They are always the same.
  • It’s easy to find the template and the sort order from the head file.
  • On next edit it knows from the head file what template and sort order it was before, if needed.

Name

I’ve decided that revision is the best name for it. I’ve googled it.

Feedback on head.txt?

1 Like

To be able to see what is happening I added the field at this early state of the plugin. That means I can deliver a teaser already.

The only thing it does is to save content into the correct folder and create folders if they don’t exist.

I had an idea of a head.txt file but I’ve tested it and it had flaws.

Sort, invisible and visible

If you change sort order on a page it creates a domino effect on many other pages. The revisions are therefor, by choice, not aware of sort, visible and invisible.

That means I don’t need it in a head.txt file.

Language

Because I was only having the language code inside the head.txt file I could not see which revisions was in english and which was in swedish in the directory structure.

Instead it simply .revisions/en/ for english revisions.

That means I don’t need it in a head.txt file.

Template

When I was having a content.txt and a head.txt I needed to have a folder for them to group them.

The only thing left in the head.txt file was the template name. To get rid of the grouping folder I got rid of the template inside the head file as well.

Instead I put it much like Kirby does, like this:

2016-04-15@07.58.16-default.txt

Because the date/time always uses the same number of characters, it’s really simple to get the template name from the filename.

The result for it is this:

  • Easy to see what revisions is in what language.
  • No messing around with sorting, at all.
  • All revision as single files in a directory. Not deeper than it needs to be.

Just some thoughts about why I changed my mind this time.