Re: Edit Index.json To Assign A Different Page As The Homepage

Edit Index.json To Assign A Different Page As The Homepage

mrenish
Visitor
3 0 0

wan't to set the homepage to one of the static pages built in Shopify.

 

How should I be editing index.json to assign a different page as the homepage? The page name is /pages/landingpage

 

Many thanks in advance

Replies 3 (3)

Weaverse
Shopify Partner
82 27 38

Hi @mrenish,
I have this idea by using a custom section:

  1. Create a new section file by going to the Sections folder in your Shopify theme and clicking on Add a new section. Name the section something like landing_section.liquid.

  2. In the landing_section.liquid file, add the following code to load the landing page content:

 

{% assign page = pages.landingpage %}
{{ page.content }}

 

  • Save the changes to the landing_section.liquid file.

  • In the index.json file, add the following code to load the landing_section:

 

{
  "sections": {
    "landing_section": {
      "type": "landing_section"
    }
  },
  "order": [
    "landing_section"
  ]
}

 

  • Save the changes to the index.json file.

  • Go to your Shopify admin dashboard and navigate to Online Store > Themes > Customize And check the result.

    If you want an easy-to-go alternative solution, you can use our Weaverse Section Builder app. This app allows you to create and manage custom sections in Shopify easily. With Weaverse, you can write custom HTML/Liquid code and add your landing page there, then publish and use it from the theme customizer. Using Weaverse can make managing your custom sections easier and create a custom homepage for your Shopify store.

Helping merchants build super unique, high-performance storefronts using Weaverse + Hydrogen.
Looking for Development & Agency partners.
If you find the answer helpful, give it a thumbs up!
Our App: Theme Customizer for Shopify Hydrogen
Join our Weaverse + Hydrogen community: Weaverse Community
mrenish
Visitor
3 0 0

Thank you that worked.
But I ran into another problem though. The homepage shows up no content. However the landing page was created as a template within the theme customization.

mrenish_0-1679547944638.png

 

mrenish_1-1679548010792.png

 

Do you see anything out of the line here?

Thank you again for your help

 



Weaverse
Shopify Partner
82 27 38

If your page uses a custom template, you can search for that template by the name starting with "page.allabtjune" in Theme => Edit Code, copy its content, and paste it to index.json.
If the file is in Liquid, you can paste it into the landing section that you've created.

Helping merchants build super unique, high-performance storefronts using Weaverse + Hydrogen.
Looking for Development & Agency partners.
If you find the answer helpful, give it a thumbs up!
Our App: Theme Customizer for Shopify Hydrogen
Join our Weaverse + Hydrogen community: Weaverse Community