Hola! ¡Tenemos nuestra Comunidad en Español!

Blog post selector field - v2 custom modules

Top Contributor | Platinum Partner

It appears that the 'Page' option under 'Selectors' column in v2 custm module field types presents the user with a list of landing pages to select, yet the 'Blog' selector only allows the user to select an entire blog - not an individual post.

 

Am I missing something?

 

5 Replies
Esteemed Advisor

@Craig,

 

That appears to be the case. Blog article pages are available in navigation settings. 

 

You could set the value of "blog_post_by_id" to a text field in your custom module:

{% set my_post = blog_post_by_id(module.blog_id.textfield) %}

Then use the result in your markup, like in the docs example:

<ul>
    <li>
        <a href="{{ my_post.absolute_url }}">{{my_post.title}}</a>
    </li>
</ul>

You just have to find the blog post id. I would like to know if there is a better way to find this, but if you go to the details page for any page or blog post then look at the url, the second number is the blog post id:

https://app.hubspot.com/content-detail/xxxxxxx/blog-post/5688172099/performance

 

Need help? Hire Us Here

- Jonathan Sumner
Reply
0 Upvotes
Top Contributor | Platinum Partner

@Jsum

Thanks - but would actually be easier to get them to paste a link rather than getting the user to find an ID. I was hoping to avoid that though - since the blog posts will be HubSpot content it makes sense that the dropdown behave the same way for the user that the Page selector does.

 

Anything in the pipleine do you think?

Reply
0 Upvotes
Esteemed Advisor

I wouldn't know who to ask about that. 

 

If you could dynamically create choice fields then you could loop through the blog posts to create a drop down out of the titles. I used the choice field from the docs and it doesn't give errors, but it also doesn't include the choice field in the module preview so if it does apply it to the page it would be outside the module. Just like the page selector field, the original choice module isn't the same as the custom module's choice field.

 

Other than that I would say you are left with the text field or blog post id.

 

Need help? Hire Us Here

- Jonathan Sumner
Reply
0 Upvotes
Top Contributor | Platinum Partner

@Jsum good idea - but I tried that in a different project and yeah, it doesn't let you dynamically create the choice field within a v2 custom module.

 

Thanks anyway!

Reply
0 Upvotes
Highlighted
Occasional Contributor

Absolutely baffled that this is still an issue. If you have a selector for all website pages and a selector for a blog as a whole, why isn't there a selector for a specific blog post? Definitely needs to go into the pipeline.