Joomla is able to maintain a version history for each of its articles. This feature is extremely useful to be able to go back a few steps in case of unexpected errors. Let's see how to activate it and how to use it!
I made a mistake!
Everyone makes mistakes when entering or editing text online: sometimes you delete paragraphs by mistake, sometimes you delete a word without meaning to, sometimes you simply change your mind. Joomla allows you to go back to a previous version, simply with a click!
Just like dropbox, google drive or other cloud storage systems, up to 10 old versions of the article are saved in the database. This number can be changed from the options, and you can also choose to keep certain versions 'in evidence', so that they are never deleted.
Let's check that the Joomla version system is active
First of all, let's check that at the configuration level everything is in order. First of all, make sure you have a Joomla version higher than 3.2 (which is the version where this feature was released). If this is not the case, make a backup immediately following our guide and update!
Then go from the top menu to Content -> Articles
Then click on the Options icon in the top right-hand corner:
Then we go to the 'Edit Layout' tab:
Here we find the two options that interest us:
- Enable versions: must be set to YES, and allows us to take advantage of this feature
- Maximum no. of versions: by default this is 10, it can be increased or half to 0 (zero). In the latter case, it simply means: 'always save all versions'.
It is generally not recommended to leave the number of versions very high (or even infinite) because for sites with many articles, the risk is that the database will fill up quickly. In general, 10 is the right number to use.
How can I restore a previous version of an article?
Now to the actual use of this feature: enter any article on your site.
In the top bar, you will see a new button called 'Versions':
Clicking on it will bring up a screen like this:
If you have just activated the feature, there will obviously be no history, because it has not yet been created. If you make several changes and save your article from time to time, the history of all these files will gradually appear.
Let us analyse this window:
First we see a list of versions, where the clickable part is the 'date'. Clicking on the version that interests us will restore the content of the article, exactly as it was at that precise moment. The yellow star is used to identify which is the current version. The convenience is also in going 'back and forth' between versions, the process is reversible!
The Keep column (with yes/no option) is used to tell the system that you want to keep a certain version in the database, even if you reach the famous 10 that we had set in the options. This is an excellent opportunity in the event that the article has received substantial modifications or that we are not fully convinced of.
Finally, selecting two versions with the checkbox and clicking on the Compare button will open a page showing the differences between the two files.
As mentioned above, once you have identified the version to be restored, simply click on the date or select it with the checkbox and click on Restore to roll back the content of the article. And that's it.
Attention: custom fields and tags are not saved in versions!
This is unfortunately a sore point: if you use custom fields they are not saved in versions. What is restored is only the content of the article, if you have deleted a custom field then it is lost forever. This is a problem that has plagued this feature for years and indeed can lead to many problems, especially since it is not explicitly stated anywhere. You can find a discussion about it on GitHub.
If you liked this article, please share it!