title: Make anchor links refer to the current page when using <base>
body: <p>When I use the HTML <code>&lt;base&gt;</code> tag to define a base URL for all relative links on a page, anchor links also refer directly to the base URL. Is there a way to set the base URL that would still allow anchor links to refer to the currently open page?</p>
  <p>For example, if I have a page at <code>http://example.com/foo/</code>:</p>
  <hr />
  <p>Current behaviour:</p>
  <pre><code>&lt;base href=&quot;http://example.com/&quot; /&gt;
  &lt;a href=&quot;bar/&quot;&gt;bar&lt;/a&gt; &lt;!-- Links to &quot;http://example.com/bar/&quot; --&gt;
  &lt;a href=&quot;#baz&quot;&gt;baz&lt;/a&gt; &lt;!-- Links to &quot;http://example.com/#baz&quot; --&gt;
  </code></pre>
  <p>Desired behaviour:</p>
  <pre><code>&lt;base href=&quot;http://example.com/&quot; /&gt;
  &lt;a href=&quot;bar/&quot;&gt;bar&lt;/a&gt; &lt;!-- Links to &quot;http://example.com/bar/&quot; --&gt;
  &lt;a href=&quot;#baz&quot;&gt;baz&lt;/a&gt; &lt;!-- Links to &quot;http://example.com/foo/#baz&quot; --&gt;
  </code></pre>