Content got duplicate when create multiple pages with the same template

HungVu
New Member
2 0 0

Hi there.

I created page-1 with the page.alternate.liquid template, and the page-2 with the same template too. In the template i use the section in the theme.

The problem here is that when i change image or content for page-1, page-2 get changed too.

Is there anyway too solve this problem beside create a new template and new section with the same code but just different name?

0 Likes
PaulNewton
Shopify Partner
2579 134 440

@HungVu wrote:

I created page-1 with the page.alternate.liquid template, and the page-2 with the same template too. In the template i use the section in the theme.


Do you mean you created two pages(page-1&page2) and you've set them both to an alternate template so they use the same template file 'page.alternate.liquid' which means they share the same section as well.

When you edit the section it's the same section used for both pages, you need to make a separate unique template if you want unique unshared sections.

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
HungVu
New Member
2 0 0

Thank you for reply

I tried to use different template for different pages but the result are the same.

The only option i have is to create both different section and different template. exp: page.alternate.liquid has section-1, page .alternate-2.liquid has section-2 and section-1 and section-2 has the same code.

This way is not very good because i need to create a lot of pages for different products, and each time i create a page i need to also create 5,6 files with duplicate code.

Just wonder if are there anyway for me to reuse my code so that i just need to create 1 time only?

0 Likes
PaulNewton
Shopify Partner
2579 134 440

You would need to make each section only work on an assigned page exclusively, if you have a lot of pages and a lot of sections this will quickly get out of hand just like the multiple file approach.

Example setting inside a a block in a section to be used later by the logic checking if a block should be shown.

 

        "settings": [
          {
            "label": "Only show on",
            "id": "exclusive_page",
            "type": "page",
            "info": "exclusive page to show this section on, if not set will show on all pages"
          }

 

Then in the snippets,etc 

 

    {% for block in section.blocks %}
        {% if block.settings.exclusive_page != blank %}
          {% if block.settings.exclusive_page != page.handle %}
            {% continue %}
          {% endif %}
      {% endif %}

 

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
emily30
New Member
1 0 0

hi paul,

i am having this issue, could you please help me out. I am unsure of what to do. here is the link to my site. I need to show my client tomorrow so I am in need of help, fast!

https://bstyleslash.myshopify.com/pages/training-test

so my about us page, courses page and 3 day lash course pages i want to use the same page template for all 3, however if i edit the content on any of the pages, as you can see they are all now exaclty the same. How do i make it so they can all be customised individually and not affect each other?

Thankyou

0 Likes
Spoken
New Member
1 0 0

Were you able to resolve this issue? I'm experiencing this right now and it's very frustrating. Thank you!

0 Likes
PaulNewton
Shopify Partner
2579 134 440

@Spoken ,etc

You have to make NEW templates and sections, as I outlined to have separate content in this ways.

 

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes