In commits by Simon McVittie on Oct 5, 2014, the following was added to cgitemplate():

b0a35c81 (Simon McVittie   2014-10-05  61)  my $topurl = $config{url};
3b8da667 (Simon McVittie   2014-10-05  62)  if (defined $cgi && ! $config{w3mmode} && ! $config{reverse_proxy}) {
b0a35c81 (Simon McVittie   2014-10-05  63)      $topurl = $cgi->url;
b0a35c81 (Simon McVittie   2014-10-05  64)  }

I am trying to determine what was intended by this change. The variable $topurl is not used again in this function, so this is essentially dead code. --blipvert

If you look at git log -p IkiWiki/ you'll see that at the time, $topurl was used further down the function. Later in the branch, commit 33f6026 "In html5 mode, generate a host- or protocol-relative for the CGI" made this conditional on ! $config{html5}.

Somewhat later, commit 490a1ec "Always produce HTML5 doctype and new attributes, but not new elements" repurposed $config{html5} from "use HTML5" to "use new HTML5 elements" - which meant that commit a052771 "Now that we're always using HTML5, can be relative" could remove the only code that used $topurl.

You are correct to say that computing $topurl is now dead code, and I have removed it. done --smcv