Variable

Hi there,

I’m trying to understand the utility of the content.name variable in emails. The descrition is the following:

The name of a post, email, or page. For pages and emails this will print the internal content name, while for posts this will print the post title. For blog posts, this is the post title that displays. For other types of content, this is generally an internal name. This variable includes a wrapper so that it is editable via the UI, when included in blog posts. If you want to print the content name without a wrapper, use page_meta.name.

My question is, does it mean if I use this variable in an HubSpot autonated email campaign, and inform the blog post webpage in the variable manager it will print automatically the post title?

You can find the list of variables here: HubL variables - HubSpot docs

Thank you

Hi @KJourdia,

If content.name is used without further information (like inside a loop) it will display only the internal name of the page, mail you’re looking at. Not of other elements(pages, mails, posts…)

Internal name means: How you name it in your Hub.
For instance:
If you call your email: Newsletter | Preperation for INBOUND23

this will be printed as the name on this particular page

If you want to display a name or something similar outside somewhere else you’ll need a bit more code.

If you’re goal is to display something like a “post-preview” with title, maybe a bit of a intro text and a “read more” button of one or more posts(you could also filter them by tags btw) I’d recommend to create a custom module to make your and the life of the content creators/marketers easier.

You can use almost all blog variables/loops to create the kind of info you’re looking for.

Here’s a quick run-down of the popular post loop:

The default code from documentation

{% set pop_posts = blog_popular_posts("default", 5, ["marketing-tips", "sales-tips"], "popular_past_month", "AND") %}
{% for pop_post in pop_posts %}
 <div class="post-title">{{ pop_post.name }}</div>
{% endfor %}

If you’re building a custom module you can easily replace this code to something like

{% set pop_posts = blog_popular_posts(module.blog_selector, module.blog_amount, module.tag_selector, "popular_past_month", "AND") %}
{% for pop_post in pop_posts %}
 <div class="post-title">{{ pop_post.name }}</div>
<div class="post-preview">{{ pop_post.post_body|striptags|truncate(200, "...", false) }}</div>
<div class="read-more-wrapper">
<a href="{{ pop_post.absolute_url }}">{{ module.read_more_text }}</a>
</div>
{% endfor %}

with some available elements like

Also you can create custom “smart-rules”(more advanced feature and wouldn’t suggest to hard code those) directly in the code.

best,

Anton