Content Items in Orchard

Tags: Orchard Beginner, Orchard CMS, Content Items, Drafts, Soft Delete, Versioning

Welcome to Orchard Beginner! Content Items are instances of Content Types, just like objects are instances of classes. Content Items are the heart and soul of Orchard i.e. they store all the data you need to handle and display.


The text marked with black color is the Title of the Content Item and the text marked with red color is the actual Content Type i.e. Page for the current Content Item.

Content Items are always versioned every time you modify any data on them and are never hard-deleted(Only Soft-Deleted) to keep the integrity of your database.

Content Items in Orchard are versioned by default. When you edit a content item and publish the modifications you don't overwrite what was previously published instead you create a new version which when published will become the published version.

Versioned means a draft is created which has the latest edited or saved changes for a given Content Item.

Pages are "draftable". This means that you can create a draft , i.e. not published(not visible).

That said let's see what happens:

  1. You create a new Page and save it, i.e. click the Save button. You don't click Publish now. This means the Page is saved, but only as a draft. Nobody can see it on the frontend. The Page only has a single version that is a draft. At the same time this version is the latest version.

  2. You now publish the Page (e.g. click Publish now in the editor). This means the Page is now visible on the frontend. The Page only has a single version that is the published one, which is also the latest.

  3. You now edit the Page and save it. This creates a new version of the Page: one is published (and visible) and one is a draft (not visible). So our Page now has two versions; the draft one is the latest (since it's newer than the published version).

  4. You now edit the Page again and save it. Editing a draft won't create a new version: only editing a published version and saving it will create a new version. So our Page still has two versions, one being the draft with the content you just saved and the other one being the published version.

  5. You now edit the page and instead of clicking Save you click Publish now. This saves the changes to the draft, then publishes it. This means our item still has two versions, both published (the result would be the same if we would just clicked Publish draft from the admin listings: it would made the draft version published).

  6. If you now unpublish the item the latest published item will be pushed back to the draft state. This yields that the first version, the published one will be published and again you'll have the latest version as draft.

Soft Deletes :

Beware that when you remove content items no record is really deleted as Orchard operates with soft deletes: content items are only marked deleted but remain in the database. Actually what happens is that all version of the content item get unpublished and simultaneously loose their flag of being latest; i.e. in the end no version will be marked as published nor latest, thus the item won't be found when fetching the published version.

Happy Orcharding!



No Comments

Add a Comment