Print current blog topic on listing page

We have a blog concise.co.uk/insights. We would like to print out a heading for the listing pages which reflect the topic which has been chosen. So for example for the url Resources | IT Resource Hub the heading for that listing page would be the topic name which is Backup & Disaster Recovery.

Hey @GillBraysh

Thank you for the information provided. I’ll tag a few experts.

Hey @Kevin-C @piersg @Chris-M what would you advise in this case?

Thanks

Sharon

Hi @GillBraysh, and thanks for the tag @sharonlicari.

This should do it. Put this in place of whichever title you want to replace, e.g. if you’re replacing “Our perspective”:

{% if topic %} {% set my_tags = blog_tags('default', 250) %}
 {% for item in my_tags %}
 {% if topic == item.slug %}
 <h2>{{ item }}</h2>
 {% endif %}
 {% endfor %}{% else %} <h2>Our perspective</h2>{% endif %}

Edit: there is actually an easier way of doing this.

{% if topic %} 
 {% set topicName = page_meta.html_title|replace(group.html_title ~ ' | ', '') %} 
 <h2>{{ topicName }}</h2>{% else %} <h2>Our perspective</h2>
{% endif %}

I did this and it works good on the first page of the listings, but on any further listing pages it ads the page number. Anyway to remove that?

Ie:

Page 1 H1= Business Growth

Page 2 H1= Business Growth (2)