# Tagsname كـ H2

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

<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:** [6 أغسطس 2023، 6:31ص UTC](https://meta.discourse.org/t/tagsname-as-h2/273935/4 "2023-08-06T06:31:38Z")

</div>

عذرًا، هذه هي مشكلتي. لقد أجريت بعض التعديلات على هذا

```javascript
<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>

```

---

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