Feature idea - autosave content as draft

Topics: Core
May 9, 2012 at 10:55 AM


I just lost one hour of writing today, because by the time I wanted to publish a blogpost, my login session had expired. Of course, I could have saved the content while editing it, but that's not what I wanted to discuss about.

What if orchard had a feature that autosaves your blog posts or pages as drafts every x minutes, while editing them? I think it would be a very useful feature, and I'm imagining it's not very hard to implement. I'll investigate how this can be done this evening, but until then, I wanted to see if anyone else has any suggestions.

What I would like to achieve

  • New blogposts & pages are saved automatically but not published while editing them
  • Feature can be activated / deactivated through the settings page

My questions for now are

  • First of all, does this make sense to you? I'd love to hear some feedback, I'm sure this will be an useful option but I'm also sure that I haven't considered all the implications yet
  • Secondly, can this be a generic aproach? i.e. save any new content automatically that supports the 'publish later' feature. This might be a naive assumption, but bare with me on this one :)
  • Thirdly, should this be a feature built into orchard, or can this be developed as a custom module? I'm not sure if a custom module would be able to affect creating new blogposts or creating content pages


Andrei Scripniciuc

May 9, 2012 at 5:01 PM

This can totally be done as a module. I don't see why it should be linked to PublishLater though. In my opinion this should be a Content Part that you can add to specific types. It could be attached automatically to Page and Blog Post by default during setup. A general setting could define the interval at which content is saved.

This part would just render a javascript, which would trigger the save button asynchronously. It there are validation errors (like no title) the page would not be saved though. It could also generate a simple message to ran the user of the draft, of if the auto save failed because of a validation issue.

May 9, 2012 at 5:04 PM

There could be such a feature of course, all we need is for someone to build it. This being said, the actual problem can be much better addressed by using a proper desktop application to write your posts, such as Live Writer. It's a million times more comfortable than any online editor can be, and it will not lose your contents.

Jun 4, 2012 at 6:10 AM

Not everyone is using orchard 'just' for blog-type content ;)

We for example are using it for a rather big company site with plenty of content. To put short, in the past what would be 5-6 pages will now be just one page.

You can imagine that inputting this content isn't possible (without them just copy/pasting html...) using something like Live Writer.

So I'd say it would be nice for Orchard to offer some sort of hookable system that parts can hook into to make them 'compatible' with 'autosaving' in the background.

Jun 4, 2012 at 7:05 AM

Have you tried looking up a tinyMCE autosave plugin? It seems there is one http://www.tinymce.com/wiki.php/Plugin:autosave

Maybe this is inappropriate for your use(?) not sure, just thought I'd throw it out there.

Jun 4, 2012 at 7:06 AM

Yes, it isn't really appropriate for our use, but thanks anyhow.

Jun 4, 2012 at 4:22 PM

That's a good point.

Jun 4, 2012 at 4:49 PM

In my old webform days I remember I had done something similar, using the idea of serializing an HTML form, and being able to bind it again. This way you could have a part which would inject this script to any content type you want, and call it's own service to auto save the form itself. Then inject auto saved values if they exist when you enter edit mode. Should not require any modification to Orchard parts or modules.

Jun 4, 2012 at 7:15 PM

Nowadays, you can do that with local storage on the browser. I use that on one of my apps, and it works great.