Useful Contentful hacks
When learning to use Contentful, the following tips around version history, content linking, scheduling and finding entries quickly may help make editing easier.
Version history
Every time we update an entry in Contentful and hit publish, then a new version is created
You can see previous versions of a page/component/assembly in the righthand column of the entry under Versions
By hovering your mouse over the date of each version, you can see which content editor published these changes (any time you see ‘Edited by’ followed by no name, it means the user’s account has been deleted so is probably someone who’s left the org)
To compare a previous version with the current iteration, select the date of the version you want to compare and select Compare with current version
In the new window you will see a side by side of the current and previous version
Any greyed out sections are where content has not changed
Any clickable sections are where there are content changes
If you select one/several sections from the previous version, you can restore these changes by the clicking Apply changes
Content linking
In the righthand sidebar, you will see a section called Links
Here you can see any content within the CMS that is referencing the current page, data, component or assembly’s entry you are currently in
If you are ever making changes to live content, you should always check what other content is referencing the entry before hitting publish
For example, if you were editing a content card being used on a particular page, but it was also being used on three other pages, you would want to make sure the edits made sense for all four pages and not just the one you were working on
This functionality is also useful when archiving content as the system uses the Links to remind you that other content may be affected if you for example are unpublishing a particular component also being used on another page
You should always try to unlink content before archiving it
Similarly, you should unlink and archive unused components, assemblies and data entries linked to a page you are archiving instead of just archiving the page entry. If you don’t unlink and archive these too, they will just hang around filling up the system despite being no longer needed
Scheduling
You can schedule an entry to go live at any time
Using the publish button on an entry, select the down arrow and choose Set schedule
Choose the time and date to publish and confirm
Remember that if components and assemblies being referenced on the page are themselves still in draft and aren’t scheduled to publish ahead of a page’s scheduled publish, your page publish will fail
Similarly, any changes made to already live components and assemblies that haven’t been published ahead of the page’s scheduled publish, mean the page will update without those changes being visible to the user
Finding page entries quickly
The best way to keep content findable is by giving it a logical name
Our general rule is to name your content by what it’s message or purpose is, not by what content type it is e.g. avoid naming components things like ‘Row 2’ or ‘Private renting two column block’
There are two easy ways to find the entry for as existing page
The first is to filter by content type and then the page slug
So, to find the what we do page, which has a slug of what_we_do, I would select Page – Content in Content type
Now hit filter on the righthand side of the bar and choose slug
Type in what_we_do and the page entry should come up
Contentful has a very sensitive internal search, so unless you capitalise a page’s title exactly the same as it is in the front end or enter a slug in lower case separate by underscores, the system probably won’t find you your entry
Neil’s magic shortcut
The second and arguably easiest way to pull up a page’s entry is to use Neil’s magic shortcut.
To do this you will need to add a new bookmark in your browser
Enter the following code into the URL field:
javascript:fetch("/edit-in-contentful.js").then(t=>{if(!t.ok)throw new Error("This is not a Contentful website.");{const t=document.createElement("script");t.src="/edit-in-contentful.js",document.body.appendChild(t)}}).catch(t=>{alert(t)});
Hit save and make sure you are logged into Contentful
Now go to any page on the Shelter website
Click the bookmark you just saved and it should redirect you to the Contentful entry for the Shelter page you are on