Jump to content

Show filtered category name at the top of the filtered content page

Recommended Posts

13 hours ago, SarahCashmore said:

Has the twcsl link changed? When I click the link, I get an error message.

My apologies. Please try the link again. It should be working now. Let me know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
  • 2 months later...

This keeps popping up quite a bit, I fixed it doing this.

The blog category is displayed in the title tag. This bit of javascript will find it and publish in a div with an ID of "title-content"

Just paste this into a HTML block and replace SITE TITLE with yours.

The blog category title will be published in the block. 

    <div id="title-content"></div>
    <script>
        // Retrieve the title tag content
        let pageTitle = document.querySelector('title').textContent;
        
        // Remove the site title
        pageTitle = pageTitle.replace('SITE TITLE', '').trim();
        
        // Remove everything after the first "—"
        pageTitle = pageTitle.split('—')[0].trim();
        
        // Display the filtered title content on the page
        document.getElementById('title-content').textContent = pageTitle;
    </script>

This assumes you are using the Squarespace default em dash as a separator within the title tag

Edited by DavidCliff
Link to comment
11 minutes ago, giftsonthegoldcoast said:

I am trying to add a description to each Category.

Please post the URL for a page on your site where we can see your issue. For us to see the URL you need to include the link in the content of your post. The URL field the forum software provides is not shown to us.

A link to the backend of the your site won’t work for us, i.e. a URL that contains /config/.

Please set up a site-wide password, if your site is not public and you've not already done so.

Post the password here.

Adding a site-wide password does not allow anyone to alter your site. It only allows those with the password to see your site.

Please read the site-wide password and how to share a link documentation to understand how they work.

You may find How to post a forum question post useful.

We can then take a look at your issue.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Link to comment
34 minutes ago, giftsonthegoldcoast said:

I am lost with all of this.

Your confusion may come from this thread is talking about blog pages and your page is a store page.

Please see the following.

 

Edited by creedon

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

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.