Oh sorry this is my problem. I made some adjustments for this
<script type="text/x-handlebars" data-template-name="/connectors/discovery-list-controls-above/tag-h2">
<h2>
{{#if h2_tag}}
{{h2_tag}}
{{/if}}
{{log this}}
</h2>
</script>
<script type="text/discourse-plugin" version="0.8">
api.registerConnectorClass("discovery-list-controls-above", "tag-h2", {
setupComponent(args, component) {
function getTagNameFromURL(url) {
return /\/tag\/([^?]+)/.exec(decodeURI(url)).at(1)
}
if (window.location.pathname?.startsWith("/tag/"))
component.set("h2_tag", getTagNameFromURL(window.location.pathname));
api.onPageChange(url => component.set("h2_tag", getTagNameFromURL(url)))
},
});
</script>