How can I style sections in an alternative index template?

Hi, I am creating a website with some members only content and need an alternative homepage which will display for logged in members. I have an app installed to show/hide content and I’ve created a new index.liquid template (index.members-index.liquid), but when I include my sections on it they don’t display properly. They either don’t show up at all or show up blank/ with placeholder content. Is there a way of accessing the alternative template in order to style it? I can see it at url/?view=members-index but not within the actual editor in order to style the sections. I tried adding them to the main homepage and styling them there there but it didn’t help.

You can create different sections for logged in customer or guest.

In you sections for logged in customer only, wrap the code with {% if customer %}{% endif %} so the code will only show when customer has logged in

In you sections for guest only, wrap the code with {% unless customer %}{% endunless %} so the code will only show for guest

{% if customer %}
  // your section code for logged in customer
{% endif %}
{% unless customer %}
  // your section code for guest only
{% endunless %}

Hi, thanks for replying. I’m happy to continue with the app I’m using, I just need to know how I can style my alternative index template. At the moment I have two templates:

index.liquid which contains {{ content_for_index }} - this is displayed to new customers,

and

index.members_index which contains {% section ‘my_custom_sections’ %} - this is displayed to members.

When I view the second template through url/?view=members_index I can see some of my custom sections but they’re empty or contain default text. Others aren’t showing up at all. I can’t find a way to access this template through the editor in order to style it. At the moment the page being displayed to members by the app has no usable content on it. That’s the bit I’m having trouble with. Thanks.

You can try this way to access this template

Example I’m on homepage and the URL on browser is

https://my-store.myshopify.com/admin/themes/120319148141/editor

Then you can add in the text ?previewPath=/?view=members_index then hit Enter

https://my-store.myshopify.com/admin/themes/120319148141/editor?previewPath=/?view=members_index

Just an idea, not tested yet.