1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[Docs] Internal Linking

Discussion in 'Design and Layout' started by Nick, Oct 23, 2009.

  1. Nick

    Nick Well-Known Member

    Hotaru offers two kinds of links, standard and url-friendly. Site administrators can choose between them by changing the Friendly URLs setting in Admin->Settings.


    Friendly URLs OFF:

    Friendly URLs ON:

    As a theme designer, you won't know which setting the site owner has chosen, so Hotaru provides a special function for creating links to match the Friendly URLs setting.

    In your templates, create links like this:

    <a href="<?php echo $h->url(array('page'=>'page_wanted')); ?>">Page Wanted</a>
    The first array element should be the page name, and you can follow that with other key=>value pairs.

    If you are need to add a fragment at the end for jumping to specifi points within a page, e.g. a comment with a #c102 anchor, you'll need to attach that separately, i.e.

    <a href="<?php echo $h->url(array('page'=>'page_wanted')); ?>#c102">Comment 102</a>
    Note 1: If you need to link to a page with over three key=>value pairs, it's best to hard-code the url in the standard way, i.e. not url-friendly.

    Note 2: If you want to link to an Admin page, you can do it like this:

    <a href="<?php echo $h->url(array('page'=>'page_wanted'), 'admin'); ?>">Admin Page Wanted</a>
    Using url-friendly urls for admin pages is quite limited and since Admin pages aren't SEO critical, it is more reliable to simply hard-code such links.

    Note 3: This topic is also covered in the Plugins documentation here.

Share This Page