On this page:
The site_url tag is a single tag which returns the full URL of the site (as defined in the Preferences panel) as text. If you maintain local development versions of your live sites and import databases between them, then this tag is extremely valuable for ensuring your domain links are never confused (and thus broken) between the two locations (see example 1, below).
This tag has no attributes.
Example 1: Maintain accurate domain paths
<nav> <ul> <li> <a href="<txp:site_url />articles">Articles</a> </li> <li> <a href="<txp:site_url />photos">Photographs</a> </li> </ul> </nav>
A classic example is with navigation links - the idea is that you don’t break URL paths after importing a database from local development to live, or vice versa. By using this tag it will automatically be relative to a given site and you’ll never have to manually edit broken domain paths again.
Example 2: HTML header paths
<link rel="stylesheet" href="<txp:site_url />assets/css/main.css">
Example 3: Display a hyperlink to download a .ZIP file
<a href="<txp:site_url />download.zip">Download</a>