I'm new to Craft and I'm wondering if Craft is able to display the differences within an entry in different versions.

Comparing 2 versions of the entry and highlighting the changes.

Something similar like most of the mergetools do.

I'm aware that the user can comment the last changes.

  • I had a reason to try and access revision data from a template the other day, but couldn't a way. I'd love to know if this is possible. Jan 18 '16 at 16:29

That's currently not a native feature in Craft, but you might want to consider voting for this similar feature request.

You could pull it off with a custom plugin in the meantime, too. Since entry revisions are stored between saves, you'd need to pull that revision data from the database using the EntryRevisionsService, add the business logic for calculating the diffs and come up with a UI for displaying it.


On the frontend, you can use Diff plugin.

So, this code to fetch versions for entry:

{% set versions = craft.entryRevisions.getVersionsByEntryId(entry.id, entry.locale) %}

Get specific version:

{% set version = craft.entryRevisions.getVersionById(versionId) %}

And to compare a specific field:

{{ craft.diff.html(entry.title, version.title) }}

  • Great plugin, thanks for posting. Just worth pointing out that this only compares two strings, so you'd need to loop through each field in use to diff each one. And if you're using matrix/table/Neo fields this could get quite complex and require additional logic.
    – Simon East
    Apr 30 '17 at 21:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.