Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Hiding comma between tags on a blog summary


Kmcgrath

Question

How do I target/hide/remove the "," between tags on a grid summary block in 7.1? I've successfully edited the tags themselves with 

.summary-metadata-item--tags a{
    color:#3b5ed8!important;
    background:#ced7f5!important;
  }

But can't figure out how to target that pesky comma!

(site is under NDA, cannot link to)

Link to post
  • Answers 6
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

This feels wrong to do, but this javascript should remove it.  Add it to your code injection under settings -> advanced for the page you want to change. <script> window.onload = function(

6 answers to this question

Recommended Posts

  • 1
Posted (edited)

This feels wrong to do, but this javascript should remove it.  Add it to your code injection under settings -> advanced for the page you want to change.

<script>
window.onload = function(){
  var tags = document.getElementsByClassName('summary-metadata-item--tags');
  for(i=0;i<tags.length;i++)
    tags[i].innerHTML = tags[i].innerHTML.replace(/\,/g,'');
}
</script>

 

Edited by ChrisBartow

Creating websites using Squarespace at Design by Donuts 🍩

Link to post
  • 0

That achieves the desired result, thanks!

Is there no way to do it with just CSS? I don't know javascript at all so I don't understand what that script actually does.

Link to post
  • 0
6 hours ago, Kmcgrath said:

That achieves the desired result, thanks!

Is there no way to do it with just CSS? I don't know javascript at all so I don't understand what that script actually does.

There isn't. CSS allows you to only do some basic text manipulation, typically adding things before or after.

The script does the following:

  • Waits for the document to load.
  • Searches for all the elements that have the class 'summary-metadata-item--tags'.
  • Loops through each of these elements
  • Replaces every occurrence of a comma (,) with an empty string ('') in the element.

It's not really an elegant solution, but since you can't change the underlying HTML, it's the only solution at the moment.

Creating websites using Squarespace at Design by Donuts 🍩

Link to post
  • 0

Thanks this worked for me removing the comma from Blog Post MetaData Categories! Just had to replace the Element Class Name!

 

Link to post

Create an account or sign in to comment

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


×
×
  • Create New...