How can I disable a link if no url exists

DenDonnar
Shopify Partner
1 0 0

Hi guys,
Is it possible to disable link if no url exist. I just want to make it without `#` for  exable "my-website.com/pages/products" instead of "my-website.com/pages/products#".

And if it's possible, the question is how can I make it if my page in .json format.

Thanks in advance!:)

Reply 1 (1)

kaalTechGeeks
Shopify Partner
308 57 77

Hi @DenDonnar
I see you have asked two questions both of which are independent to each other. So I would like to answer both of your questions.

------------------------------------------------------------------------------------------------------------------------------

1. Yes you can implement a permanent redirect to URLs of your store which you don't want your visitors to see. 
For this you need to follow the below steps: 
1. Login to your admin panel of your store. 

2. Go to Online Store > Navigation. 

3. Click on View URL Redirects at the top right corner of your screen below the header as shown in image.Screenshot (512).png

4. Then click on 'Create URL Redirect' at the top right corner. 

5. Two fields will show up, in the first field enter the URL you want to replace/disable; In the second field enter the URL you want to replace it with. If you are not sure then simply redirect it to the homepage by entering '/' in the box. Click on submit button to save the URL. 
6. Boom! you have successfully disabled a broken URL.   

-----------------------------------------------------------------------------------------------------------------------------------

To create a page template in JSON format you need to first go to online store and select a specific theme in which you wish to add the JSON template. 
  a. Click on edit code. Shopify theme editor will open. 

  b. From the template sections click on Add a new template. 

  c. Select page from the list of options available and choose JSON in file type also add the custom name to your page template as shown in image. After you have done the above steps hit save.  Screenshot (513).png d. the file with your custom name would be visible on the screen. If your theme is 2.0 then automatically default JSON code will add to your template else you have to add the code for JSON template. 
e. If no code is added then add the below code

 

{
    "sections": {
         "main": {
               "type": "main-page",
          }
      },
    "order": [
      "main"
    ]
} 

 

where you can replace the "main-page" with the name of the page template of yours theme. 
f. Once you have done all the changes then congrats you have created a custom JSON template. 
You can refer to https://shopify.dev/themes/architecture/templates/json-templates to understand more about shopify JSON templates.  

 

Thanks & Regards 
Kaal

- If my answers saved you time and headaches, consider buying me a coffee!
- Check my profile: KaalTechGeeks | Reach out to me on my socials - Instagram | Skype | Mail
- Was my reply helpful? Click Like to let me know! & if your question was answered, Mark it as an Accepted Solution!