Code injection at the end of each article

Good day.
How correct inject code at the end of each article?
I am trying to put the widget code.
Thank you.

Hi John,

I’m probably far too late!

I was just trying to complete this myself.

This was my solution for injecting HTML at the end of each post, it may only work for the liebling theme:

<script>
// Get the section element
var sectionElement = document.querySelector('section.m-tags.in-post');

// Create a new element to inject
var newElement = document.createElement('div');
newElement.innerHTML = 'Your HTML content goes here';

// Insert the new element before the section element
sectionElement.parentNode.insertBefore(newElement, sectionElement);
</script>

I just placed this in the site footer.

If this dosen’t work, it’s probably best going into inspect element on your site and finding the HTML tag that marks the end of the post and replace section.m-tags.in-post with this. The script will inject just above that tag.

It’s worth noting that this could stop working if the tag name changes with a ghost update.