Cache can get in the way when you’re editing a template. This post is a brief guide to bypassing cache in the least annoying way possible.
TemplateSandbox extension
The absolute best way to get around cache is to use Extension:TemplateSandbox if it’s available on your wiki (it’s enabled on all wiki.gg wikis by default).
This method is the best because:
- It requires the least amount of clicking
- You only need to save the template at the very end, which will:
- Reduce strain on the jobqueue
- Keep your edit history clean
- Reduce the chance of edit conflicts that might happen if someone else notices an incomplete change to the template
Here’s what you do:
- Type the name of the page you want to preview. In this case, I want to see the template’s own documentation subpage
- Click “Show preview”
- You will then see a preview of your chosen page in the same place that the normal preview action (alt+shift+P) would show up
Save-and-preview method
If you don’t have TemplateSandbox enabled, then this is probably your next-best option. As a reminder, TemplateSandbox is always enabled on wiki.gg, you do not need to request it from staff. But, you may still want to use this option if you’re worried about data loss if you go too long without saving.
- Open your target page in one tab in edit view
- Open your template in another tab in edit view
- Make changes to your template
- Use the normal preview action in your target page’s tab (alt+shift+P or click “Show preview”)
- You will now see how the page looks with the updated template
- If more changes are needed, go back to step 2.
Some useful hotkeys to make this process easier (on Windows computers):
- Alt+Tab (if you are using 2 separate windows, which is a good idea if you have multiple monitors)
- Ctrl+PgUp and Ctrl+PgDn (if you are using different tabs in a single window of your browser)
- Alt+Shift+P (preview page in MediaWiki)
- Note, if you forgot to open the edit mode of your target page, then Alt+Shift+P will open Print Preview instead, so you’ll have to close out of that and then go to edit view before pressing Alt+Shift+P a second time
- Alt+Shift+E (edit page in MediaWiki)
Save-and-purge method
The final method I’ll suggest is to use the ?action=purge
action on the target page. This is much more convenient if either (a) Cargo or SMW is installed and you can use the “Purge cache” or “Refresh data” buttons that those extensions provide; or (b) you have a gadget/JS snippet providing a “purge cache” tab in the “More” dropdown by the searchbar.
On wiki.gg, all wikis created since about April 2024 should have a purge cache option, and if you don’t have one you can request one from staff.
The process is:
- Edit and save the template
- Purge cache on the target page, via one of the following methods:
- On the target page, visit
?action=purge
by editing the URL (always works) - If Cargo is installed, click “Purge cache”
- If SMW is installed, click “Refresh” or “Refresh data”
- If you have some other gadget providing a “purge cache” button, click that instead
- On the target page, visit
A purge is (almost) always necessary at the very end
Remember, for both the TemplateSandbox and the save-and-preview options, you still only previewing the change on the target page, and you will still need to purge cache once at the end for the change in the template to be reflected (or wait until the cache expiry interval expires).
If your wiki has page caching turned off (only ever the case on some small private wikis) or if the __NOCACHE__
parser function is being used (again usually only ever the case on some small private wikis) then you may not need to do this.