Mecha CMS

User guide.

Add External Link to a Page

To add an external link to a page, navigate to the page editor then click the Data tab. Put your external link in the Link field.


The link data will be available in $page->link object so you can add this data to the template like so:

<?php if ($page->link): ?>
<a href="<?php echo $page->link; ?>" target="_blank">Link</a>
<?php endif; ?>

Most of the theme uses this simple PHP logic to switch between page URL and page link:

<a href="<?php echo $page->link ?: $page->url; ?>">
  <?php echo $page->title; ?>