Runway: How to add a link-only page to main nav pointing to a category in blog archive

  • I have an archive page in blog. Visiting /news/category/category-name will show a list of all the posts in that category.


    I want to add a link to the main navigation which is a link to /news/category/important-updates


    If I create a new page and give it the URL segment '/news/category/important-updates' Runway creates a new page for this url so it's impossible to reach the category archive intended.


    How can we create items in nav, that as with normal Perch, are 'Page already exists or is a link only'?

  • There is more than one way to achieve this. Which way you use depends on how (or if) you want the editor to manage this URL and where you want the URL to be placed.


    For instance, if you always want this URL to be the last in the navigation links list, you can add it inside perch:after:


    HTML
    1. <perch:after>
    2. <!--* Add link here *-->
    3. </ul>
    4. </perch:after>


    You can hardcode it there if it makes sense in your use case. Or you can generate the URL outside the template and pass it as a variable to the template.

  • If you want to keep using Perch navigation functions, you can create a page with a different URL and set it to redirect to the URL you want. This way you avoid the conflict. You can have an editable region in your master page to edit the URL you want to redirect to:


    PHP
    1. $url = perch_content('URL', true);
    2. PerchUtil::redirect($url);


    Another option would be to create a shared region and let the editor manually manage the links.