{"id":205,"date":"2018-10-10T12:01:40","date_gmt":"2018-10-10T12:01:40","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2018\/10\/10\/add-top-link-in-magento-2\/"},"modified":"2025-05-22T17:17:31","modified_gmt":"2025-05-22T11:47:31","slug":"add-top-link-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/add-top-link-in-magento-2\/","title":{"rendered":"How to Add Top Link in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Website header is the best place to show links of the important pages. Top links on a website effectively engage users and ease the access to pages like \u201cMy Account\u201d, \u201cMy Wishlist\u201d, \u201cMy Cart\u201d, etc. It helps to redirect the users to particular pages such as wishlist page or cart page, where chances of the conversions are high! The top links must be configured in such a way that it serves multi-purpose of easy navigation and boost sales.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Magento 2 has various default top links as My Account, Wishlist, etc. Sometimes, store owners require to add custom&nbsp;<strong><i>Magento 2 top links<\/i><\/strong>&nbsp;to strategize improved user experience and sales boost.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Today I\u2019ve come up with the tutorial to&nbsp;<i><strong>add&nbsp;<\/strong><\/i><i><strong>top<\/strong><\/i><i><strong>&nbsp;link in Magento 2.&nbsp;<\/strong><\/i>Use the code as per your requirement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Method to Add Top Link in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Go to&nbsp;<strong>app\/code\/Vendor\/Extension\/view\/frontend\/layout\/default.xml<\/strong>&nbsp;and paste the below code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n    &lt;body>\n       &lt;referenceBlock name=\"header.links\">\n            &lt;!-- Contact us Link -->\n            &lt;block class=\"Magento\\Framework\\View\\Element\\Html\\Link\" name=\"contactus.link\" after=\"register-link\">\n                &lt;arguments>\n                    &lt;argument name=\"label\" xsi:type=\"string\" translate=\"false\">Constact Us&lt;\/argument>\n                    &lt;argument name=\"path\" xsi:type=\"string\" translate=\"false\">contact-us&lt;\/argument>\n                &lt;\/arguments>\n            &lt;\/block>\n            &lt;!-- CMS Page Link Link -->\n            &lt;block class=\"Magento\\Framework\\View\\Element\\Html\\Link\" name=\"aboutus.link\" after=\"contactus.link\">\n                &lt;arguments>\n                    &lt;argument name=\"label\" xsi:type=\"string\" translate=\"false\">about Us&lt;\/argument>\n                    &lt;argument name=\"path\" xsi:type=\"string\" translate=\"false\">about-us&lt;\/argument>\n                &lt;\/arguments>\n            &lt;\/block>\n \n        &lt;\/referenceBlock>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Once you implement the above code, you are able to redirect users to any CMS page focussed on specific information, with the help of top links.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For the programmatic method to remove the top link, refer our blog to <a href=\"https:\/\/meetanshi.com\/blog\/remove-top-link-in-magento-2\/\" target=\"_blank\" rel=\"noreferrer noopener\">remove top link in Magento 2<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Website header is the best place to show links of the important pages. Top links on a website effectively engage users and ease the access&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-205","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=205"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/205\/revisions"}],"predecessor-version":[{"id":15582,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/205\/revisions\/15582"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=205"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}