How to Create a CMS Page in Magento 2 and Add it’s Link to Top Navigation Menu

Home >> Blog >> Magento 2 >> How to Create a CMS Page in Magento 2 and Add it’s Link to Top Navigation Menu
How to Create a CMS Page in Magento 2 and Add it's Link to Top Navigation Menu

Magento 2 has been making its mark as the most successful platform for eCommerce since it has been upgraded from Magento 1 to magento 2 back in 2015. Along with the well-known businesses now small-sized businesses are also migrating their online stores to Magento2. The reason is Magento 2 provides a wide range of inbuilt functionalities, high scalability, security and continuous growth in development.

If you are already using Magento 2 platform for your ecommerce store website then you are certainly on the correct trend.

Whether you have built a custom store with the help of Magento 2 development company or if you have used any premade template to set up your website, you are always stuck with one requirement which comes across almost all of the eCommerce websites that is, How to create a CMS page and then add its link to top menu navigation?

Obviously there is a quick solution or rather a turnaround for this where you can just create a CMS Block->Add content in there from the page->Save and then in Products->Categories->Design tab->Select that Static block. With this you can show the content in category but cannot get the desired page content on the specific URL you want to use on your Magento eCommerce store.

But now you can put your own custom link in the main category navigation menu using the guide we have provided in this blog post

We have created a guide for you on how you can create a CMS page and then add its link to top navigation menuof your Magento 2 website with step by step detailed information.

Create a CMS Page

Let’s start with creating the CMS page you want to add in navigation top menu. Go to Admin -> Content -> Pages

Create a CMS Page

Click on Add New button to create a new page


Enter details of your new page and for example let’s say page name as “new page” and please note down the URL Key specified as “new-page”. Add the content for page and click on “Save Page”.


Add CMS Page link to Navigation Menu

Next step for this is that you have to do customization to your theme’s XML file which will let you add your own code to specific sections of your template.

Basically you can achieve this by editing your theme’s layout XML file but I would recommend creating a small custom code with extension so that your theme files stay intact which will help you with theme upgrades and all its support in future

First I’m going to define a Namespace as “Mageice” and ModuleName “NavigationLink” for my extension. Create a file named “default.xml” in Magento 2 root at location


Put below code in the created file:

That’s all i think . Please feel free to contact our Magento 2 developers if you need any more customization done on your magento 2 web store to achieve your unique business goals


8 Replies to “How to Create a CMS Page in Magento 2 and Add it’s Link to Top Navigation Menu”

  1. Hi! I have 2 questions:
    1) What kind of a URL should I use instead of “cms_page_url_key”, an absolute or a relative one?
    2) What If I need to add links to all CMS pages to the top bar? And only those?

    Thank you!

    1. Hello Razvan,

      Here’s answer to your questions:

      1. This “cms_page_url_key” is the url of your page which you have created in admin from CMS Pages. In my example above you can see that its “new-page” based on the page title “new page” so if your page title is “Magento 2 Developer” then automatic url key generated will be “magento-2-developer” which you can change to any unique url. After that you can use that key in the file.

      2. If you want to add multiple links then you can repeat same process again to add another in with another class values for different file in same path and create new Block file with different page’s unique url key. Thanks!

  2. Hello! Can you answer me for my question please?
    If i want to add my page at the top navigation i must to create some module with all neccessery configuration(registration, initialization, controller etc) for first, right?
    I do all steps like this guide, but nothing to appear in top-navigation. Parent theme is blank.
    So, waiting for your reply. Thanks you very much!

  3. What about taking all of that page content and putting it into a static block and just creating a category for the nav menu item? You can add the block to the category but still be able to add related products to the bottom of the page.

    1. Yes Matt, that is also a possibility and we have pointed that out to try it first in the beginning of the blog. However, this blog focuses more on getting the page itself in the menu instead of going through moving content to block and then assigning the block in the category.

Leave a Reply

Blog Categories
eCommerce Services
Recent Posts
Get Free Quote Now