from the documentation: "{{ topic }} - the topic variable can be used to render markup for a topic listing. It also contains the properties: topic.name and topic.slug." But it doesnt seem to be the case. I'm getting the {{topic}} variable which is the slug, but other variables, like {{ topic.name }}, i can't get. Is this an issue with hubspot or am i misunderstanding something? The page im trying to output it at is a topic page. Example http://example.com/blog/topic/cars-dogs and i would like to get the name of the current topic im in so "Cars dogs" or whatever you named it.
Hey @Armandas if you're trying to get the topic name to display on the topic page you'll have to use a bit of a workaround which is noted here (http://designers.hubspot.com/docs/hubl/blog-content-markup#if-topic-statement). So you'd want to use an {% if topic %} statement on the listing page. In between the if and the endif is where you'd put your topic page specific content. If you wanted to pull the name of the topic page you'd want to use:
{{ page_meta.html_title|replace('Your Blog Title | ', '') }}
You'd then want to replace the "Your Blog Title" in that with your blog's HTML title. Basically on a topic page, the HTML title of the page is "Your Blog Title | Topic Name". The "| Topic Name" part is generated automatically. The solution above is basically a workaround that removes the first part of the Title and leaves you with the topic name. You can also set that value as a variable and use it multiple times within the {% if topic %} statement if that is easier. For example:
{% if topic %}
{% set topicName = page_meta.html_title|replace('Your Blog Title | ', '') %}
<h2>{{ topicName }}</h2>
<p>On the {{ topicName }} page we talk about {{ topicName}}.</p>