Jump to content

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

Recommended Posts

15 hours ago, alcmarket said:

but it's so strange, it's not showing in the logged out preview, but when I'm logged in, it's there (see attached). I have it placed right underneath the main 'Projects' title. But it doesn't show up in the logged out preview.

 

You've run into a bug that has presented before. Please see the following for a workaround.

When in Preview the text block you set up will always show because the code doesn't run in Preview.

When not in Preview the code only runs on category or tag list pages.

ScreenShot2023-03-05at10_46_46AM.png.cab7c78458d980089877db1189ac8fbf.png

Let us 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

I have updated my twcsl code which my cited code in my February 12th 2021 post depends on.

From the changes...

fix for twcsl.page.blog.hasCategory not recognizing category url slugs in the ?category=myCategory format on v7.1 sites

@alcmarket You may want to reinstall twcsl per the Install steps, if you don't want to use the work around. Be sure to remove the old version of twcsl.

@dbailey You may want to update your code as well. Both twcsl and Blog Page Section Text Replace With Category or Tag, or Both (if needed).

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

@creedon Thank you!  The new code worked!

Second question, on this tag page, I'd like the SEO title tag to reflect the page's tag as well, and not be the overall website title.  Can I enter code to adjust that, so that each of these tag pages have a unique SEO title tag?

Link to comment
17 hours ago, cka said:

I'd like the SEO title tag to reflect the page's tag as well, and not be the overall website title.  Can I enter code to adjust that, so that each of these tag pages have a unique SEO title tag?

While is it possible to alter the title of  a page with JavaScript, any code we can install happens client side. That means that the code is running in the browser and is not altering the title that is generated by SS's servers.

It is up to search engine crawlers to decide if they want to run client side JavaScript or not. There is no guarantee that the search engines will pick up the client side altered version of a page title.

I know of no code that alters blog category or tag list page titles.

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

Hello,

Please can you help me to customise the page title with the category name on the blog pages. I've read through this thread and tried your code in the header but I can't get it to work.

Here is the link to the site: https://rhombus-seal-pky3.squarespace.com/all-works?p

It is still in trial. The password is: flexerandsandiland.

You can see all the categories in the drop down menu under Works.

Thanks for your help.

Screenshot 2023-03-14 at 21.21.20.png

Link to comment
On 3/14/2023 at 2:33 PM, TheCutOuts said:

tried your code in the header but I can't get it to work.

You've not followed the first step in the install process.

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
3 hours ago, TheCutOuts said:

I followed the steps but still not working. Not sure what I'm doing wrong.

You have a syntax error in the code.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"</script>

It should be the following.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

There is a missing > ( right angle bracket or greater than character ) in your code near the end.

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
20 hours ago, creedon said:

You have a syntax error in the code.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"</script>

It should be the following.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>

There is a missing > ( right angle bracket or greater than character ) in your code near the end.

OK - updated that but now I get this -

Sorry - help!

Screenshot 2023-03-16 at 20.20.50.png

Link to comment
7 hours ago, TheCutOuts said:

updated that but now I get this

You still have syntax errors. Your missing a opening script tag.

It should begin something like this.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>

  const twcsl = ( ( $ ) => {

 

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
On 3/17/2023 at 4:02 AM, creedon said:

You still have syntax errors. Your missing a opening script tag.

It should begin something like this.

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>

  const twcsl = ( ( $ ) => {

 

Still not working I'm afraid. Looking at the code there were bits in bright green, is that normal? See screenshots.

Screenshot 2023-03-18 at 09.19.38.png

Screenshot 2023-03-18 at 09.21.56.png

Screenshot 2023-03-18 at 09.22.24.png

Screenshot 2023-03-18 at 09.22.56.png

Screenshot 2023-03-18 at 09.23.20.png

Link to comment
10 hours ago, TheCutOuts said:

Still not working I'm afraid.

Given the number of errors in the code (those errors are not in my code) I'm thinking you've had a copy and paste mishap. I suggest clearing the code out and start from scratch. Be very careful when you copy and paste.

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
On 3/18/2023 at 8:21 PM, creedon said:

Given the number of errors in the code (those errors are not in my code) I'm thinking you've had a copy and paste mishap. I suggest clearing the code out and start from scratch. Be very careful when you copy and paste.

Hi - I deleted everything and copied the jquery code into notepad before copy and pasting it into Squarespace. I did the same with the code from the browser.

Still not working. Really don't know what I'm doing wrong. Are there still errors from the copy and paste?

Thanks for your help.

Link to comment
25 minutes ago, TheCutOuts said:

Still not working. Really don't know what I'm doing wrong. Are there still errors from the copy and paste?

It appears you've got the jQuery and twcsl installed correctly. Now the only thing left is steps 2 & 3 from the install instructions.

Be very careful with your copy and paste. I have found that when you get to the field, take a beat, gives the field a few seconds to load. Then place your insertion point and verify that the insertion point is where you want the code to go. It also doesn't hurt to put a couple of blank lines in to also help with knowing where the code is going.

If you think you've made a mistake, cancel and try again.

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 weeks later...
On 3/23/2023 at 8:54 PM, creedon said:

It appears you've got the jQuery and twcsl installed correctly. Now the only thing left is steps 2 & 3 from the install instructions.

Be very careful with your copy and paste. I have found that when you get to the field, take a beat, gives the field a few seconds to load. Then place your insertion point and verify that the insertion point is where you want the code to go. It also doesn't hurt to put a couple of blank lines in to also help with knowing where the code is going.

If you think you've made a mistake, cancel and try again.

Hello - me again.

Sorry, still having trouble with this. I've checked and re-checked the code. Carefully copying and pasting it from text edit. I feel like I've followed all the steps here and here and still nothing.

What am I doing wrong?

 

Link to comment
  • 6 months later...
On 10/20/2023 at 2:17 PM, ddchan said:

Could you please take a look and see what I might be doing wrong? If you're able to take a look, that'd be much appreciated.

I think it might be a bug in my code but as I was diagnosing the issue it appears you have removed the code?

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
  • 2 months later...

Hi I'm trying this code above but can't seem to get it to do anything.

I have both tags and categories on one of the blogs on my site. I'd like to be able to have the filter results pages by tag, have the tag displayed at the top and the filter results pages by category, have the category displayed at the top. I've tried both methods above but seem to be missing something.

Link to comment
12 minutes ago, sasyrae said:

I'm trying this code above but can't seem to get it to do anything.

Please post the URL for a page on your site where we can see your issue.

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.

We can then take a look at your issue.

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

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
  • 1 month later...
On 1/11/2022 at 5:54 PM, creedon said:

Yes that is exactly the issue! For some reason SS on the blog pages uses the /category/Care style for the links but when you create nav links with the SS interface they use the ?category=Care.

Looks like I'll need to account for that in my next version of twcsl!

In the meantime you could edit the Link pages and change the format of the URLs to the /category/Care style.

@creedon I am having a similar issue with my client's site. I have installed the code, but it is showing up blank.... https://www.haiirology.com/blog?category=HAIR TOOLS 

Edited by BroadbentStudio
Link to comment
  • 4 weeks later...

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.