I have added a custom cms-page link in customer account navigation. My custom link is showing in account navigation and working too, but it's not showing as active/current on click.

Cms-page > Design > Layout Update XML

     <referenceContainer name="sidebar.main">
        <block class="Magento\Framework\View\Element\Template" name="customer_account_navigation_block" template="Magento_Theme::html/collapsible.phtml" before="-">
                <argument name="block_title" translate="true" xsi:type="string">Account Dashboard</argument>
                <argument name="block_css" xsi:type="string">block-collapsible-nav</argument>
            <block class="Magento\Framework\View\Element\Html\Links" name="customer_account_navigation" before="-">
                    <argument name="css_class" xsi:type="string">nav items</argument>
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="customer-account-navigation-subscription-form">
                        <argument name="path" xsi:type="string">manage-subscription</argument>
                        <argument name="label" xsi:type="string">Email Subscription</argument>
                        <argument name="position" xsi:type="string">20</argument>

Cms-page url:http://domain.com/manage-subscription/


1 Answer 1


I'm wondering if this does not quite work because this is a cms page and its possibly not matching absolutely. The Module Controller Action normally needs to match. In this case it's a CMS page so the page i think has the following absolute path: cms/page/view/page_id/1 where 1 is your page id so you could try changing path to below:

 <argument name="path" xsi:type="string">cms/page/view/page_id/1</argument>

This is a bit of a guess and would maybe debugging with the file that matches the links and sets them as active.

If this does not work you could debug by temporarily modifying vendor/magento/framework/view/element/html/link/current.php

This couuld be debugged by adding below code to isCurrent() function at around line 82 before return:

echo "CURRENT:" . $this->getCurrent() . "PATH:" . $this->getUrl($this->getPath()) . " MCA: " . $this->getUrl($this->getMca());

Or by doing similar in get MCA to work out why it isn't being matched. If you look at the code you should see what is going on and why the MCA does not match the path and what the MCA needs to be set to for it to match and the exact path that is needed to be used.


I normally create a controller rather than a CMS page for additional pages in customer area and the links set as active fine there so could be worth setting up like that.


You could also cheat a bit and do something like the following to workaround issue.

var url = window.location.pathname+window.location.search;
var els = document.querySelectorAll("a[href='" + url + "']");

This would set any active links to have a class.

  • Thanks for reply <argument name="path" xsi:type="string">cms/page/view/page_id/1</argument> not working. Commented Sep 5, 2017 at 9:45
  • I have fixed this by making some changes in current.php, will post answer later. Commented Sep 5, 2017 at 9:45
  • Nice one yeah would be good to know what was happening.
    – harri
    Commented Sep 5, 2017 at 9:46
  • I need to know, How should I override vendor/magento/framework/view/element/html/link/current.php file Commented Sep 5, 2017 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.