Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

The Diff Module

Parent Feed: 


Credits & Thanks

Thank you to:

About the Diff module

The Diff module shows you differences between revisions to nodes. This function might not sound like a big deal, but if you see an increase or decrease in traffic, it’s helpful to see which edits caused the change. If you don’t use this module you should keep good records about every little change you make to your site.

To reduce the tedious nature of that kind of record keeping, turn on the Create New Revisions feature in Drupal Core for each Content Type using the Diff module.

Turn On “Create New Revision” for All Content Types

When editing a node, you can create a new revision without overwriting the original. You do this by selecting the Create new revision checkbox from the Publishing options tab. You can set your individual content types to select this checkbox by default when any new content is created. This preset saves a little time and ensures that revisions are saved no matter who edits your content.

  1. Click Manage > Structure > Content types (Coffee: “content types”) or visit https://yourDrupalsite.dev/admin/structure/types in your browser.
  2. Next to the first Content Type, open the drop-down menu under the Operations heading, next to “Manage fields”, and click the Edit link.

    content type edit link

  3. Near the bottom of this screen, click the Publishing options vertical tab near the bottom of the screen and make sure the Create new revision checkbox is selected. Some may have it selected by default, others may not.

    publishing options within a content type

  4. Click the Save content type button at the bottom of the page.
  5. Repeat steps 2-4 for each Content Type.

Install and Enable the Diff Module

  1. Install the  module on your server. (Go here for more instructions on installing modules.)
  2. Go to the Extend page: Click Manage > Extend (Coffee: “extend”) or visit https://yourDrupalsite.dev/admin/modules in your browser.

    diff module install and enable

  3. Select the checkbox next to “Diff” and click the Install button at the bottom of the page.
  4. There are no separate permissions required for the Diff module

Configure the Diff module

  1. Go to the Diff admin page by clicking Manage > Configuration > Content authoring > Diff (Coffee: “diff”) or visit https://yourDrupalsite.dev/admin/config/content/diff/general in your browser.

    diff module configuration screen

  2. Click on the Fields tab at the top to display all the Entity Type fields.
  3. Go through the Plugin column drop-down selectors for every Entity Type field and (if available) turn them all on.

    NOTE: The “on” setting will vary from field to field. Some fields will have no way to turn them on (“Don’t compare”) -- leave these as they are and move to the next field. Other fields will have multiple options -- select the one that best suits your site’s needs.

    diff module configuration screen

    At the very least, make sure the following field types are turned on:

    • Body
    • Title
    • Authored
    • Revision log
  4. Click the Save button at the bottom of the page.

Using the Diff module

  1. Make sure you are logged into the admin area.
  2. Go to a piece of content where you have saved revisions.
  3. Click the Revisions tab.

    diff module revisions tab

  4. You will see a list of revisions with radio buttons. Select the two revisions you wish to compare.

    drupal diff module in action

  5. Click the Compare selected revision button at the bottom.

    Note: If there are no revisions of your node, you will not see this option as there isn’t anything to compare.

    drupal diff module example in action

The node’s fields are displayed side-by-side with the changes highlighted. This screen makes it easy to see what edits made a difference in your search rankings, click- through rates, and conversions.

  • If you see “+” between the fields, that means some text was added.
  • If you see “-“, it means that some text was deleted.

Did you like this walk through? Please tell your friends about it!

twiter social icon linkedin social icon pinterest social icon

Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web