Steps to add custom link for CMS page in magento 2 header are as under

  • First create a CMS page for example we will create an about us page with identifier as “about-us”.

  • Now usually, to access the cms page in frontend, we use www.domain.com/{identifier}

  • So, the top link that we will add for the about us page should redirect to www.domain.com/about-us

  • To add the top link, we will add following code in default.xml of our theme

Path to the file: app/design/frontend/Magento/themename\Magento_Theme\layout\default.xml