Jump to content

Adding a header to a "tag page"

Go to solution Solved by Beyondspace,

Recommended Posts

Site URL: https://www.adriannexo.com/journal/tag/Travel

I've been trying to figure out a way to add a title or intro onto the blog "tag pages" meaning when a viewer clicks on a tag such as "Drinks", the top of the page will say something like "Drinks".

I thought it used to automatically have an intro that said "Posts in ___". Is there a way to add that back in?

This is one of the tag pages I have. Not sure if CSS or a markdown block is the answer here but I'm hoping someone can help! -- https://www.adriannexo.com/journal/tag/Travel

Link to comment
  • Solution
7 hours ago, adriannexo said:

Site URL: https://www.adriannexo.com/journal/tag/Travel

I've been trying to figure out a way to add a title or intro onto the blog "tag pages" meaning when a viewer clicks on a tag such as "Drinks", the top of the page will say something like "Drinks".

I thought it used to automatically have an intro that said "Posts in ___". Is there a way to add that back in?

This is one of the tag pages I have. Not sure if CSS or a markdown block is the answer here but I'm hoping someone can help! -- https://www.adriannexo.com/journal/tag/Travel

Add this to code injection

<script>
document.addEventListener('DOMContentLoaded', function() {
  if (location.href.indexOf("journal/tag")) {
    var tag = location.href.substring(location.href.lastIndexOf('/') + 1);
    document.querySelector("#block-60f61d06c24cc7419f80222f").innerHTML = "Posts in "+tag;
  }
});
</script>

"#block-60f61d06c24cc7419f80222f" is the block id of an empty text block you added on block page, it shared across tag and category page

image.png.f8b77def32a60b3085840c29e920e002.png

image.thumb.png.9599796778717ae3bf2fb3aca1562bad.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
21 hours ago, bangank36 said:

Add this to code injection

<script>
document.addEventListener('DOMContentLoaded', function() {
  if (location.href.indexOf("journal/tag")) {
    var tag = location.href.substring(location.href.lastIndexOf('/') + 1);
    document.querySelector("#block-60f61d06c24cc7419f80222f").innerHTML = "Posts in "+tag;
  }
});
</script>

"#block-60f61d06c24cc7419f80222f" is the block id of an empty text block you added on block page, it shared across tag and category page

image.png.f8b77def32a60b3085840c29e920e002.png

image.thumb.png.9599796778717ae3bf2fb3aca1562bad.png

 

Hi again! I noticed some tags that are two words such as "Home Tour" appear at "Home+Tour" due to the url. I've been trying to get a Replace() method to work but I haven't had any luck.

I'm essentially just wanting to replace all "+" with "  " (space). Would you happen to know?! 

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.