Jump to content

Summary block content order: Categories above excerpt, tags below excerpt

Recommended Posts

So I'm trying to change the order of content in my summary block to:

1. Title
2. Primary Metadata (Categories)
3. Blog Excerpt
4. Secondary Metadata (Tags)

The css I've created below successfully does this on all blocks except the Metadata, because they are in a lower class. Is there a way to take Primary and Secondary Metadata out of their shared class, so they can be treated as independent elements like the summary title and excerpt?

.summary-content.sqs-gallery-meta-container , .summary-content.sqs-gallery-meta-container .summary-metadata-container.summary-metadata-container--below-title
{ display: flex;
  flex-wrap: wrap;}

.summary-title{
  order:1!important;}

.summary-metadata.summary-metadata--primary{
  order:2!important;}

.summary-excerpt{order:3!important;}

.summary-metadata.summary-metadata--secondary{order:4!important;}

 

Website: https://www.beehyve.health/resources
Password: abc

Link to comment
14 hours ago, melaniejaane said:

So I'm trying to change the order of content in my summary block to:

1. Title
2. Primary Metadata (Categories)
3. Blog Excerpt
4. Secondary Metadata (Tags)

The css I've created below successfully does this on all blocks except the Metadata, because they are in a lower class. Is there a way to take Primary and Secondary Metadata out of their shared class, so they can be treated as independent elements like the summary title and excerpt?

.summary-content.sqs-gallery-meta-container , .summary-content.sqs-gallery-meta-container .summary-metadata-container.summary-metadata-container--below-title
{ display: flex;
  flex-wrap: wrap;}

.summary-title{
  order:1!important;}

.summary-metadata.summary-metadata--primary{
  order:2!important;}

.summary-excerpt{order:3!important;}

.summary-metadata.summary-metadata--secondary{order:4!important;}

 

Website: https://www.beehyve.health/resources
Password: abc

This is the standard layout of Dom on summary block: 

image.thumb.png.2c9ba12a15cc5e341306711bf0fffd78.png

The 'summary-metadata--primary' and 'summary-metadata--secondary' are not on the same level with the title and excerpt.

If you require this order, we need to implement js code to change some Dom element on summary block and set the right Css style for it.

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox - Lightbox captions only mode)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 No-code customisations for Squarespace
🚀 Learn how to rank new pages on Google in 48 hours!

If you find my answer useful, let's leave a like or upvote so others with the same issue can find their solution. Thank you!

Link to comment
  • 4 months later...
On 12/8/2022 at 3:42 AM, Beyondspace said:

This is the standard layout of Dom on summary block: 

image.thumb.png.2c9ba12a15cc5e341306711bf0fffd78.png

The 'summary-metadata--primary' and 'summary-metadata--secondary' are not on the same level with the title and excerpt.

If you require this order, we need to implement js code to change some Dom element on summary block and set the right Css style for it.

Thanks for your insight @Beyondspace 
Is it relatively easy to set up JS code like this? I'm familiar with CSS and html but novice with JS. Do you know of any similar snippets I could use as a base? Thanks so much 🙂 

Link to comment
  • 1 year later...

This might be a bit late (maybe others are looking) but this worked for me: 

<script>

document.addEventListener("DOMContentLoaded", function() {
summaryItems.forEach(function(item) {
    // Move the primary metadata (date) above the title
    var primaryMetadata = item.querySelector(".summary-metadata--primary");
    var title = item.querySelector(".summary-title");

    if (primaryMetadata && title) {
      title.parentNode.insertBefore(primaryMetadata, title);
    }

    // Move the secondary metadata (tags) below the excerpt
    var secondaryMetadata = item.querySelector(".summary-metadata--secondary");
    var excerpt = item.querySelector(".summary-excerpt");

    if (secondaryMetadata && excerpt) {
      excerpt.parentNode.insertBefore(secondaryMetadata, excerpt.nextSibling);
    }
  });
});

</script>

Edited by margothermans
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • 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.