0

I am trying to create a Landing Page for my Magento site. I created this by creating a new CMS page through Admin/Content/Pages. I'm wondering if I can add a custom sticky navigation menu to this page? This custom sticky navigation will be different and in addition to my default website header.

asked Oct 6, 2020 at 20:31

1 Answer 1

0

Yes, you'll have to define a file in frontend/layout with name "default.xml" which actually lets you add custom things in headers/footers. See the code below: In component you give your JS file(if you want one for making it sticky) while in template you'll use html to show whatever you want in the header. P.S: See the difference between "templates" and "template" folder.Both are different. Hope it helps!

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
 <head>
 <css src="Vendor_Module::css/vendor.cssfilename.css"/>
 </head>
 <body>
 <referenceContainer name="header.container">
 <block class="Vendor\Module\Block\File" name="name" template="Vendor_Module::"path_to_frontend_templateS"/file.phtml">
 <arguments>
 <argument name="jsLayout" xsi:type="array">
 <item name="components" xsi:type="array">
 <item name="vendor-module-name" xsi:type="array">
 <item name="component" xsi:type="string">Vendor_Module/js/view/js_file</item>
 <item name="config" xsi:type="array">
 <item name="template" xsi:type="string">Vendor_Module/"path_to_frontend_templatE"/html_file</item>
 </item>
 </item>
 </item>
 </argument>
 </arguments>
 </block>
 </referenceContainer>
 </body>
</page>
answered Oct 7, 2020 at 5:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.