JS total noob here.
I'm trying to apply this code inside tumblr theme file but it's only getting applied to the most recent post in the main feed. This is to show comment count for disqus but using {sourcelurl}
{block:ContentSource}
<a href="{permalink}" id="disqus-comment-count">0</a>Comments
<script>
let sourceurl = '{sourceurl}'
var disqusVar = sourceurl.replace("https://href.li/?","") + '#disqus_thread';
$("#disqus-comment-count").attr("data-disqus-url", disqusVar);
</script>
{/block:ContentSource}
For those wondering, the script needs to be wrapped inside {block:ContentSource}{/block:ContentSource} for {sourceurl} variable to work.
Any idea why this might be?