Jump to content

Blog Post Excerpt Glitch

Recommended Posts

Site URL: https://www.rendyreviews.com/movie-reviews

Hi I at the beginning of my posts I keep getting this glitch with my reviews whenever i post them.

1465255422_ScreenShot2021-06-16at11_15_23PM.thumb.jpg.e5bf73fa1e5891ccd28a99cde4ea9413.jpg.851275449317621c84cefe0cfbf92141.jpgThis is the code I'm working with:

 

<script>

document.addEventListener('DOMContentLoaded', function() {

    var element = document.querySelector('.BlogItem-title');

  if (!element) {

    return;

    }

    var newElement = document.createElement('h3');

    newElement.style.order = 1;

    newElement.className = "BlogItem-excerpt";

    newElement.innerHTML = document.querySelector('[property="og:description"]').getAttribute("content");

    var elementParent = element.parentNode;

 

    elementParent.insertBefore(newElement, element.nextSibling);

});

</script>

 

It works at times, it doubles up most of the time.

Can somebody help fix this for me? Thank you so much.

Link to comment
  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

On 1/14/2022 at 2:13 AM, Rendy said:

https://www.rendyreviews.com/movie-reviews/hotel-transylvania-transformania-review

 

I disabled the code for a bit but here its all over again.

It looks fine to me

image.thumb.png.5a0c28ecc88cc0ebae99df56423a8064.png

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

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

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.