I am working locally using shopify cli. I need to add pages to my theme but I am not sure how to. I want to add an about page. So I made a json file named page.about in templates. Now, how can I add a link to my navbar that will “open” that file?
I tried href="{{ page.about }}, but that doesn’t work. I image that that’s not actually how I am meant to link pages, so can someone help me out?
Hey Jahvonte,
the json you created is a page-template. To link to that you’ll have to create an actual page within the Shopify Admin Dashboard. You then can assign your template to this page.
There are multiple approaches to link to a page.
A naive one would be to get your page by it’s handle and return the url.
<a href="{{ pages['contact'].url }}">Test</a>
While the pages liquid object used above can be used to retrieve pages, you should generally use section settings, menus or theme settings to define and output links.
It seems like you are just getting started with Shopify/Liquid. Have you considered completing one of the free learning paths on Shopify Academy?
Kevin 