Separate Title Tag and Recent Posts


#1

Hey,

i cut the connection between Blog Title and Title Tag, thats nice. The thing is that in recent posts, HubSpot uses the Title Tag to display the most recent blog articles.
I would like to have the Blog Titles there. Otherwise its confusing for the reader to click on a link and get to the blog article that has a different title then.

Any ideas how this could be solved?


#2

Hi @Tintenton, are you referring to the Post Listing built in module? If so, you can create your own recent posts module but utilizing this function: https://designers.hubspot.com/en/docs/hubl/hubl-supported-functions#blog-recent-posts. The default module cannot be changed unless you clone it and make edits that way.


#4

Hey @Connor_Barley
thank you for your answer. Unfortunately that does not help me or i need some further help how.
You are right, i am referring to the recent post module in the post listing. I want HubSpot to use the actual Blogpost Title and not Title Tag when displaying an article in recent posts.
How could that function be changed so it takes blogarticle titles?
Thank you for our help.


#5

Hi @Tintenton, can you respond with a link to your blog and your HubID? You'll need to use the blog recent posts hubl tag to do what you're currently looking for, rather than the default module.


#6

Hey , https://blog.netpress.de/ is the Link and HubID: 324903.


#7

Hi @Tintenton, Is there any way you can clarify a bit further as to what your intentions are? I do not see any difference between the Title that gets displayed in the sidebar and the main title of an individual article.


#8

Sure! See here as for the difference between blog article and most read:

and the difference between blog article title and post listing:

Thank you for your help,
Antonia


#9

Hi @Tintenton, I believe the issue is with the listing template on line 59. https://app.hubspot.com/beta-design-manager/324903/templates/4310272554#module=1490616905590576.

Currently you have the title being set to:

<div class="post-header-title"><h2><a href="{{content.absolute_url}}">{{ content.name }}</a></h2></div>

the tag {{ content.name }} corresponds with the title from the Settings of your blog posts. You should instead use {{ content.widgets.blog_display_title.body.value }}. That said, it might be worth using some logic for instances where blogs may or may not have a value placed in your custom title field. Something like this should work:

<div class="post-header-title">
   {% if not content.widgets.blog_display_title.body.value %}
      <h2><a href="{{ content.absolute_url }}">{{ content.name }}</a></h2>
   {% else %}
     <h2><a href="{{ content.absolute_url }}">{{ content.widgets.blog_display_title.body.value }}</a></h2>
   {% endif %} 
</div>

#10

Hey @Connor_Barley,

thank your for that piece of code. i inserted it into the listing template HTML and replaced the one that you stated with it.

There is no effect on most read so far, can you think of a reason why?

Best regards,
Antonia


#11

Sorry @Tintenton, I think I gave you the wrong line number. I edited line 74 instead and now the post listings on the listing page have the same title as the posts themselves. For the sidebar issue, we cannot edit the popular post module to contain those titles. Instead, we'll need to use the custom code I mentioned to use your custom titles {{ content.widgets.blog_display_title.body.value }}.

For that, you'd need to create a custom module, then replace the default module to have this code:

<div class="sidebar-item">
  {% set pop_posts = blog_popular_posts('blog_id_here', 5) %}
  <h2>Meist gelesen<h2>
  {% for pop_post in pop_posts %}
    {% if not pop_post.widgets.blog_display_title.body.value %}
      <h2><a href="{{ pop_post.absolute_url }}">{{ pop_post.name }}</a></h2>
    {% else %}
     <h2><a href="{{ pop_post.absolute_url }}">{{ pop_post.widgets.blog_display_title.body.value }}</a></h2>
    {% endif %} 
  {% endfor %}
</div>