Jump to content

Pages using the same custom layout share content changes

Recommended Posts

Hi,

Apologies if this has been asked elsewhere or if it's something incredibly simple I have over looked, but I've been searching around a lot for an answer on this and I can't find any.

I have a site that is using a custom template which I am building. I have a series of .region files that contain block fields with unique IDs for each page layout.

e.g.

<div class="my-content-wrapper">
      <squarespace:block-field id="my-content" columns="12" />
</div>

However there are a couple of pages where I want to reuse the same layout but with new content, but if I make a new page (or duplicate one) and apply the same layout, the content is shared between the two pages.

This includes any changes made to one page, which then show up on the other.

It seems to me that reusable generic layouts would be a core part of a platform like Squarespace so my questions are:

  • Is this expected behaviour?
  • If not how do I rectify it?
  • If it is, what is the correct way to build a reusable layout with unique content per page?

 

Link to comment
  • Replies 2
  • Views 437
  • Created
  • Last Reply

I tried to create a unique ID for each block field on a page by interpolating the page ID into the id attribute like so. 

<squarespace:block-field id=my-content-{squarespace.page-id} columns="12" />

This did not work as the page Id was stripped from the field when I loaded the page in the CMS

Link to comment

Should anyone else find this, I have found the answer.

My instincts on interpolating the ID were correct, but the squarespace.page-id variable as outlined in the documentation isn't available in the CMS. 

Instead you should just use id. E.G.

<squarespace:block-field id=my-content-{id} columns="12" />

I hope this helps.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.