Forum

Thread tagged as: Question

change base url as language switch

After this https://forum.grabaperch.com/forum/05-19-2016-language-parameter-as-part-of-routing-param I was able to add language to URL for all URL's and created a function that return "en" content as fall back.

Need one more piece of the puzzle figured out.

I am using below code to show navigation

<?php
  perch_pages_navigation(array(
        'flat'                 => false,
        'template' => array('level1.html', 'level2.html'),
        'include-parent'       => false,
        'skip-template'        => false,
        'siblings'             => false,
        'only-expand-selected' => false,
        'add-trailing-slash'   => false,
        'navgroup'             => false,
        'include-hidden'       => false,
    ));
  ?>

All links show us as /about, /products, /faq, etc. Instead of I want them to output /es/about, /es/products, /es/faq if ES language is selected.

so always prefix language variable if it exists. How can i do this?

sawan ruparel

sawan ruparel 0 points

  • 5 years ago

I realised I could use <perch:pages id="lang" />, I was trying with <perch:content id="lang" /> so it didnt work earlier.

issue resolved

Drew McLellan

Drew McLellan 2638 points
Perch Support

Right, the namespace of the tag needs to match the app processing the tag.