Content got duplicate when create multiple pages with the same template

HungVu
Visitor
2 0 1

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?

Replies 9 (9)

PaulNewton
Shopify Partner
6274 573 1319

@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.

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


HungVu
Visitor
2 0 1

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?

PaulNewton
Shopify Partner
6274 573 1319

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 %}

 

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


emily30
Shopify Partner
2 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

Spoken
Visitor
1 0 1

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

PaulNewton
Shopify Partner
6274 573 1319

@Spoken ,etc

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

 

Save time & money ,Ask Questions The Smart Way


Confused? Busy? Get the solution you need paull.newton+shopifyforum@gmail.com


Problem Solved? ✔Accept and Like solutions to help future merchants

Answers powered by coffee Buy Paul a Coffee for more answers or donate to eff.org


jagnethn
Tourist
4 0 4

2023 And I have the same problem, I create 2 products and they share the same information.  It doesn't seem clearly how to resolve this problem.

designforcares
Visitor
1 0 0