Jump to content

Can I change my blog posts titles all at once through some code?

Go to solution Solved by tuanphan,

Recommended Posts

Hi,

So, all my blog posts have the same template title "*Name of the Movie* - SPOILER-FREE Review"

I'd like to remove the "SPOILER-FREE" part of every single blog post I have. Is there a way of doing this through code-injection or something instead of going one by one?
Thanks in advance.

Best regards,

Manuel

Link to comment
  • Replies 6
  • Views 671
  • Created
  • Last Reply

Top Posters In This Topic

16 hours ago, msbento said:

Try adding this code to Settings > Advanced > Code Injection > Footer

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $(".post .entry-title a").html(function() { 
          return $(this).html().replace("SPOILER-FREE", " ");  
    });
});
</script>

image.thumb.png.e18a359cbc1862723b91ad65f322258d.png

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution
On 12/22/2022 at 10:15 PM, msbento said:

It works for each blog post when you open it, which is already great. But how can I make it also change in the homepage?

https://www.msbreviews.com/

Homepage uses Summary Block, so you need to adjust something in the code. Use this new code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
<script>
  $(document).ready(function(){
    $(".post .entry-title a, .summary-title-link").html(function() { 
          return $(this).html().replace("SPOILER-FREE", " ");  
    });
});
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.