When creating a link to a menu item inside an article or module, my first thought is to use the menu item alias and make the link like this:
<a href="/contact">Contact us</a>
The problem is that this link might break for a series of reasons:
.htaccess
is not enabled (requires the link to include "index.php")- The alias changes (e.g. to "contact-us")
- The menu item is moved to a different level or to another parent (e.g. to "/about/contact")
- Joomla is moved to a subfolder (e.g "/joomla/contact")
How can I safely link to a menu item?