# Tagsname come H2

**URL:** <https://meta.discourse.org/t/tagsname-as-h2/273935>\
**Category:** Development\
**Tags:** tags\
**Created:** [4 Agosto 2023, 8:55am UTC](https://meta.discourse.org/t/tagsname-as-h2/273935 "2023-08-04T08:55:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)\
**Post date:** [4 Agosto 2023, 3:26pm UTC](https://meta.discourse.org/t/tagsname-as-h2/273935/2 "2023-08-04T15:26:18Z")

</div>

Scrivi del codice per ottenere ciò di cui hai bisogno. Qui ho scritto una semplice soluzione per te. Prova, dovrebbe fare quello che vuoi

```javascript

<script type="text/x-handlebars" data-template-name="/connectors/discovery-list-controls-above/tag-h2">
<h2>
    {{#if h2_tag}}
        {{h2_tag}}
    {{/if}}
</h2>
</script>

<script type="text/discourse-plugin" version="0.8">
api.registerConnectorClass("discovery-list-controls-above", "tag-h2", {
  setupComponent(args, component) {
    if (window.location.pathname?.startsWith("/tag/"))
        component.set("h2_tag", /\/tag\/([^?]+)/.exec(decodeURI(window.location.pathname)).at(1));
  },
});
</script>

```

---

_[View the full topic](https://meta.discourse.org/t/tagsname-as-h2/273935)._
