Here is the text of a delete_page DTML method that deletes a page if the page's size is zero and there are no backlinks to it. (Require zero size so that the person doing the delete must have change permission to get the size down to zero - that way you cannot delete pages like RecentChanges?, etc.) The DTML method comments that the size is non-zero if that is the problem; the method lets you know you cannot delete the page due to existing backlinks and shows the backlinks if that is the case; otherwise it calls manage_delObjects on the containing Folder. This feature is now done - it will work as long as you set the delete_page DTML method to run with Manager proxy so it can call the manage_delObjects method on the containing Folder. You must grant access contents information and view permissions to Anonymous so the method itself can run (just like RecentChanges?, etc.). You should grant Change DTML Methods permission only to Manager, otherwise anybody could edit the page and run stuff with Manager permission. **Make sure to copy from the edit screen instead of from the displayed page because [] stuff isn't displaying correctly.** -RonDagostino:

  <dtml-let pageid_to_be_deleted=id>
  <dtml-comment>Require getSize()==0 to leverage change content permissions </dtml-comment>
  <dtml-if "getSize() != 0">
  <FORM ACTION="<dtml-var wiki_page_url>" METHOD="POST" >
  <CENTER>
  You cannot delete <dtml-var "pageid_to_be_deleted"> because it has a non-zero size.
  </CENTER>
  <p>
  <p>
  <CENTER>
  <INPUT TYPE="SUBMIT" VALUE="   Ok   ">
  </CENTER>
  </FORM>
  <dtml-else>
  <dtml-call "REQUEST.set('hasReferences','N')">
  <dtml-in "aq_parent.objectValues(spec='ZWiki Page')" sort=id>
    <dtml-if "_.string.find(_.getitem('sequence-item').raw,pageid_to_be_deleted) != -1">
      <dtml-call "REQUEST.set('hasReferences','Y')">
    </dtml-if>
  </dtml-in>
  <dtml-if "hasReferences == 'N'">
  <dtml-call "aq_parent.manage_delObjects(pageid_to_be_deleted)">
  <FORM ACTION="&dtml-wiki_base_url;/FrontPage" METHOD="POST" >
  <CENTER>
  <dtml-var "pageid_to_be_deleted"> has been deleted.
  </CENTER>
  <p>
  <p>
  <CENTER>
  <INPUT TYPE="SUBMIT" VALUE="   Ok   ">
  </CENTER>
  </FORM>
  <dtml-else>
  <dtml-var "standard_wiki_header(this(),REQUEST,RESPONSE,title_url='..')">

  <h2> Cannot delete <a href="../<dtml-var id>"><dtml-var id></a> because it is linked on the following pages: </h2>
  <p>

  <dtml-let thispage=id>
  <strong> Backlink </strong>
  <br>
  <dtml-in "aq_parent.objectValues(spec='ZWiki Page')" sort=id>
  <dtml-unless "_.string.find(_.getitem('sequence-item').raw,thispage) == -1">
    <a href="../<dtml-var "_.getitem('id')()" url_quote>">
  <dtml-var "_.getitem('id')()"></a><br>
  </dtml-unless>
  </dtml-in>
  </dtml-let>

  <p>

  <p> <a name="nesting"><a href="../<dtml-var id>"><dtml-var id></a></a> nesting
  context in the Wiki folder, including offspring, ancestors, and siblings.
  (Branches are abbreviated with '...' elipses after the first time they're
  spelled out.)

  <dtml-var "context(REQUEST, with_siblings=1)">

  <dtml-if "_.hasattr(this(),'minimal_footer')">
  <dtml-var "minimal_footer(this(),REQUEST,RESPONSE)">
  </dtml-if>

  </dtml-if>
  </dtml-if>
  </dtml-let>

Here is a standard_wiki_header DTML method that displays the delete hyperlink in addition to the table of contents/recent changes links (this assumes the RecentChangesBySubjectFeature and supercedes the standard_wiki_header code there). **Again, make sure to copy from the edit screen instead of from the displayed page because [] stuff isn't displaying correctly.**:

  <dtml-comment>hack to bend acquisition to my will:</dtml-comment>
  <dtml-with "this">
  <HTML>
  <HEAD>
  <TITLE><dtml-var title_prefix><dtml-var id></TITLE>
  </HEAD>
  <BODY BGCOLOR="#FFFFFF">
  <table width="100%" border="0" cellspacing="0" cellpadding="3">
  <tr>
  <td valign="top" align="left"><small><a href="<dtml-var wiki_page_url>/delete_page">Delete <dtml-var id></a></small>
  </td>
  <td align="right"> <small>
        <a href="<dtml-var wiki_page_url>/map"> Site Table of Contents</a>
         -  <a href="<dtml-var wiki_page_url>/offspring"> <dtml-var id> Table of Contents</a>
           </small>
  <br align="right"> <small>
        <a href="&dtml-wiki_base_url;/RecentChanges"> Site Recent Changes</a>
        - <a href="&dtml-wiki_base_url;/RecentChangesBySubject?subject=<dtml-var id>"> <dtml-var id> Recent Changes</a>
           </small>
  </td>
  </tr>
  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="3"  bgcolor="eeeeff">
  <tr>
  <td valign="bottom">
  <h1>
  <a href="&dtml-wiki_base_url;"><img src="/misc_/ZWiki/ZWikiPage_icon" height=48 width=48 border=0 valign="bottom" alt="to FrontPage"></a>
  <dtml-if "_.has_key('title_url')">
  <a href="<dtml-var title_url url_quote>"><dtml-var id></a>
  <dtml-else>
  <a href="<dtml-var id url_quote>/backlinks"><dtml-var id></a>
  </dtml-if>
  </h1>

  </td>

  <td>
     <dtml-var "context(REQUEST, with_siblings=0)">
  </td>

  </tr>
  </table>

  <p>
  </dtml-with>
  <!-- end of standard_wiki_header -->

See also: ZwikiModification