-<TMPL_LOOP NAME="PAGES">
- <TMPL_IF NAME="DIFFURL">
- <a href="<TMPL_VAR NAME="DIFFURL">">
- <img alt="diff" src="wikiicons/diff.png" />
- </a>
- </TMPL_IF>
- <TMPL_VAR LINK>
+<TMPL_UNLESS HAS_DIFFURL>
+<TMPL_IF DIFF>
+<a href="#diff-<TMPL_VAR REV>" class="toggle" title="diff" rel="nofollow">[[diff|wikiicons/diff.png]]</a>
+</TMPL_IF>
+</TMPL_UNLESS>
+<TMPL_LOOP PAGES>
+<TMPL_IF DIFFURL><a href="<TMPL_VAR DIFFURL>" title="diff" rel="nofollow">[[diff|wikiicons/diff.png]]</a><TMPL_VAR LINK>
+<TMPL_ELSE><TMPL_VAR LINK></TMPL_IF>