I'm on Magento 2.1.14 and have a custom theme applied which builds off of the blank theme. The customizations through XML in the Magento_Theme directory are minimal. I added several links to the main nav bar (the same one that contains the category links) by calling a cms block in the default.xml. The cms block was created through the admin and instead of hardcoding the urls, I used {{store direct_url='path'}}
. In my default-head-blocks.xml file in my "Magento_Theme" folder, I am not calling any extra js. Code posted.
On the desktop version of the site, there are no problems with the nav bar and all links direct to their correct urls or paths. When I load the mobile version, the extra links that were added through calling the cms block all direct me to url/undefined. This only happens on the mobile version.
Does anyone have any insight into why this may be happening? I have searched for any info and it all leads back to JS or jQuery errors. But I'm basically using the majority of the Magento Blank theme and core Magento files.
Background: when I originally added the links, I tried several methods including, the current method. I initially tried adding the links directly through XML using the link class and added arguments to specificy the path. This ended up adding a trailing slash to all the paths added, so I then created redirects in the admin to direct those particular paths with trailing slashes to the correct path (without the trailing slash). That resulted in the browser crashing for a few of the links, so I removed the XML and deleted the redirects from the admin.
myThemeDirectory/Magento_Theme/layout/default.xml
<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="catalog.topnav">
<block class="Magento\Cms\Block\Block" name="additional-links">
<arguments>
<argument name="block_id" xsi:type="string">additional-store-links</argument>
</arguments>
</block>
</referenceBlock>
<referenceBlock name="skip_to_content.target" remove="true" />
<referenceBlock name="report.bugs" remove="true"/>
<referenceBlock name="store.settings" remove="true"/><!-- targets mobile menu ? -->
<referenceBlock name="store.links" remove="true"/><!-- targets mobile menu ? -->
<referenceBlock name="top.search" remove="true" />
<referenceBlock name="top.links" remove="true" />
<referenceBlock name="footer_links" remove="true" />
<referenceBlock name="form.subscribe" remove="true" />
<referenceBlock name="reviews.tab" remove="true" />
<referenceBlock name="product.review.form" remove="true" />
<referenceBlock name="product.info.review" remove="true" />
<move element="store_language" destination="header-wrapper" after="-" />
<move element="breadcrumbs" destination="main.content" before="-" />
<referenceBlock name="header.panel.wrapper" remove="true"/>
<referenceContainer name="footer">
<block class="Magento\Cms\Block\Block" name="cms-static-main-footer" before="copyright">
<arguments>
<argument name="block_id" xsi:type="string">cms-static-main-footer</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>