Greg's Blog

helping me remember what I figure out

A Little Optimisation Trick

| Comments

Here is a really nice way to reduce some of the page weight in your HTML code. Simply introduce the <base> tag into your template between the <head> tags with the URL of your site as the value of the href attribute and all of your links, path to images, styles, javascript files can be referenced relatively. Consider this example:

<a href=”http://www.tcias.co.uk/v2/products/amp.php” title=”Read more about &amp;”>Read more about &amp;</a>

Could now simply be referenced like such if you set your base href to ”http://www.tcias.co.uk/v2/”:

<a href=”products/amp.php” title=”Read more about &amp;”>Read more about &amp;</a>

This saves yourself a few bits here and there.