Here's how it's done:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('.blog-categories').each(function() { // select all elements with class "categories" and loop through them
$(this).html($(this).html().replace(/\s/g,' ')); // replace all white spaces with nbsp
});
});
</script>
<script>
$(document).ready(function() {
$('.summary-metadata-item--cats a').each(function() { // select all elements with class "categories" and loop through them
$(this).html($(this).html().replace(/\s/g,' ')); // replace all white spaces with nbsp
});
});
</script>