Creating subpages

Highlighted
Tourist
12 0 1

Hi there,

I'm working on a new site and need to have a home page and then 3 subsections sections.

  1. The first section is the shop, which will show products, collections, vendors etc.
  2. The second is going to be a collection of pages and maybe some dynamic content (using a blog)
  3. The third section will be the same as above, but containing a collection of info about the company

My questions relates to how I can customise the way shopify deals with templates or URLs. What I'd like to have is a homepage (index.liquid presumably), then have three subsections that allow me to display different content.

Initially I created an alternative template called 'index.shop.liquid' that I assumed I would be able to access by visiting www.siteurl.com/shop but it appears this is not the case. Anyone know how to access custom templates?

My second thought was to use conditionals. In the other CMS that I work with I can simply write a conditional that says [if segment_1 == 'example'] display this content, [if:else] display different content. Do you know if Shopify can do something similar?

Any help will be appreciated!

0 Likes
Highlighted
Shopify Expert
9925 103 1763


Anyone know how to access custom templates?

Start with this reference link: http://docs.shopify.com/support/your-website/5-themes/can-i-create-and-use-an-alternate-template-for...

As for conditionals those are easy enough too:

{% if my_var == 'foo' %}
   Foo!
{% else %}
   Not foo!
{% endif %}

See logic for more info.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
Tourist
12 0 1

Thanks for your response Jason.

I still don't see how I can create home pages for the three subsections. The sites home page is obviously created in the index.liquid template, but I need a way to display the other content.

I'd normally do this by setting the links in the nav to go to:

  1. site.url/one
  2. site.url/two
  3. site.url/three

Then on the index template I would write a conditional that simply said:

{if segment_1 == ''}
    Content for the main homepage here
{if segment_1 == 'one'}
    Content for the first section here
{if segment_1 == 'two'}
    Content for the second section here
{if segment_1 == 'three'}
    Content for the third section here
{/if}

Any idea how to do that in Shopify?

0 Likes
Highlighted
Shopify Expert
9925 103 1763

index.liquid is used only for the landing page / home. Other pages (excluding ones for collections, product and search) will use page.liquid.

As for you if statement perhaps you'd be looking to use handles. Keep index.liquid for the home page and page.liquid for the others. Obviously pages have their own dedicated content editor but assuming this is for something different (like a banner):

{% if page.handle == 'one' %}
    Content for the first section here
{% elsif page.handle == 'two' %}
    Content for the second section here
{% elsif page.handle == 'three' %}
    Content for the third section here
{% endif %}

If the look for those subsections homes are very different from the normal pages I would just create a new page template and assign it to them.

 

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
Tourist
12 0 1

That's the one! Thanks Jason.

If there's anything I can help you with just let me know.

0 Likes