Jump to content

Sort Ordering Tags and other Objects Alphabetically using JSON-T on 7.0 custom theme

Recommended Posts

Posted

Hi folks - I am trying to display "tags" on a Custom Post Type I call "Portfolio".

I am able to loop through the "section -> collection -> section -> tags" and then display the repeated results of each tag, but is there a way to alphabetize them? 

{.section collection}
  {.section tags}
  <ul class="portfolio-tags">
    <li><a href="{collection.fullUrl}">All</a></li>
    {.repeated section @}<li><a href="{collection.fullUrl}?tag={@|url-encode}" class="entry-tags-tag entry-tag-{@|slugify}" rel="tag">{@}</a></li>{.end}
  </ul>
  {.end}
{.end}

{.section tagFilter}
	<p class="filtered-by">Filtered by: {@|safe}</p>
{.end}

Is there a JSON-T Formatter that would help with this?

https://developers.squarespace.com/json-t-formatters

--

This is particularly crucial for me because the "Portfolio Items" are tagged by "year" ex: 1998, 1999, 2000

Problem is - the tags are not being aggregated (in the JSON) in a logical pattern that I can tell. You can see from the screenshot (attached) the tags are in a somewhat random order.

--

My hack, for now hopefully, is to create a custom create a Custom Block Field Region for this Custom Post Type that allows me to inject a simple "Tag Cloud" -> then use CSS to style it in a similar way as I intended. I am not a big fan of this, but it gets the job done for now until I can get a better solution. 

<squarespace:block-field id="portfolio" columns="12" />

Any suggestions?

 

Thanks in advance.

 

 

Screen Shot 2020-10-17 at 8.25.33 AM.png

Screen Shot 2020-10-17 at 8.28.03 AM.png

Screen Shot 2020-10-17 at 8.32.09 AM.png

  • Replies 0
  • Views 465
  • 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.