Jump to content

How to display only those custom collection items with a specific category

Recommended Posts

Site URL: https://www.red.org/blog-2

On a custom collection page: https://www.red.org/blog-2 (password: test), I have the following snippet:

  <div class="b-slider">
    {.repeated section items}
      <div class="b-slider-slide">
        <a class="b-slider-link" href="{fullUrl}">
          <div class="b-slider-img-wrapper content-fill">
            <img class="b-slider-img" {@|image-meta} />
          </div>
          <div class="b-slider-text">
            <div class="b-slider-text-inner">
              {.section categories}
                <h6 class="b-slider-article-category">{.repeated section @}{@}{.alternates with}, {.end}</h6>
              {.end}
              <h1 class="b-slider-article-title">{title}</h1>
              {.if updatedOn}
                <h6 class="b-slider-article-date">{updatedOn|date %B %e, %Y}</h6>
              {.or}
                <h6 class="b-slider-article-date">{addedOn|date %B %e, %Y}</h6>
              {.end}
            </div>
          </div>
          <div class="b-slider-overlay"></div>
        </a>
      </div>
    {.end}
  </div>

Which displays all items in the collection. How can I limit which posts display to only those with a specific tag of "popular". If I do something like this:

{.repeated section categories}
  {.equal? @ "popular"}

    markup goes here

  {.end}
{.end}

That seems to narrow the scope which prevents me from displaying the item's title, image, date, etc.

Any ideas?

/Chris

Link to comment
  • Replies 0
  • Views 203
  • Created
  • Last Reply

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.