HTML Help for Post Narrative Feature Custom Container

Hi,

I’m really hoping someone will be able to help me with this. I want to customise the HTML code I got from the setup guide for the new BETA post narration feature, which reads your blog (making it more accessible to our website users).

However, at the moment, the container is the full length of the page and doesn’t have any padding, so it looks a bit cluttered.

I want to make the container the same width as the body text and include the title “Listen Now”: ‘Title of Blog’ in the title to make it more obvious that you can listen to it.

This is the code that I currently managed to add to the template:

Thank you so much in advance! (I’m a digital marketer and HTML really baffles me so I would love to learn how to do this for myself)

Hey @TC6, thank you for posting in our Community!

Please, look for the CSS code related to the container. This might be defined in a <style> tag or an external CSS file. You’ll want to set the width of the container to match the width of your body text. This could be a percentage value like width: 90%; or a fixed width like width: 800px; Adjust this value according to your design preferences.

To our top experts, @evaldas, @Jigar_Thakker do you have any recommendations for @TC6?

Thank you,

Pam

Hi @TC6

Looks like you have the audio player added above the article and the sidebar at the same time:

The easiest way to make the player be same width as the article (body text) would be to place that HubL snippet inside the area for the article. You could even try adding it right above {{ content.post_body }} tag.

Then in order to add some spacing around the player, you will want to target the .hs-audio-player class and add the desired margin to it through a CSS rule, like so:

.hs-audio-player {
 margin-top: 20px;
 margin-bottom: 20px;
 margin-right: 10%;
}

You can update those margin values with whatever suits your layout. Ideally this would be placed in the CSS file for your blog templates - but if you need more directions on this one, let me know.

Lastly, it looks like the audio player automatically pulls in the page title of the blog post and there isn’t a simple way to override it (unless I am missing something) - so this might be good feedback to HubSpot. However, for now you could add some text right above the audio player snippet to indicate that users can listen to it:

<p>Listen to Audio Version:</p>
{% your narration module code here %}

Hope this helps!

Thank you so much for this. The instructions were really clear and easy to follow and once I implemented them, it made sense! I hope anyone else struggling with this finds this answer as it was brilliant :slightly_smiling_face:

Glad this was helpful and I appreciate the feedback! :slightly_smiling_face:

(Also a newbie)

If I want the player to appear under my blog intro but above the main body, where in the code should I paste the snippet?

Hi @CSchwanz

In order for the narration feature to work, the narration module must be outside of the blog content.

If you really wanted to, you could add an additional field to the template for having a separate intro, but it would technically not be part of your blog post - which means that intro would not appear in any post summaries or RSS feeds.

The sequence in the post template would look like this:

{% rich_text "intro" label="Intro Paragraph" %}

{# narration module code here #}

{{ content.post_body }}