Blog, Website & Page Publishing

vrneuman
HubSpot Employee
HubSpot Employee

Add alt text to the featured image on your blog homepage

For some templates, the featured image's alt text may not be populated on the blog listing page by default. This can cause SEO warnings on listing pages in your page performance tool. The easiest way to resolve this is to add an alt tag that is populated on the listing page using HubL

 

  • In your HubSpot account, navigate to Marketing > Files and Templates > Design Tools.
  • Click the name of your blog template.
  • In your blog template, click the Blog Content module
  • In the inspector under the Edit tab, click Edit listing template to open your coded blog listing template.
  • Add alt="{{ content.featured_image_alt_text }}" to the featured image img tag to populate the alt text on the listing page with the image's alt text as specified in the post editor:
img src="{{ content.post_list_summary_featured_image }}" class="hs-featured-image" alt="{{ content.featured_image_alt_text }}"
  • Alternatively, you can add alt="{{ content.name }}" to the featured image img tag to populate the alt text attribute on the listing page with the blog post's title. 
img src="{{ content.post_list_summary_featured_image }}" class="hs-featured-image" alt="{{ content.name }}"

Please note: including {{ content.name }} in the blog post template might result in HTML code rendering on your post. If you want to print the blog post title without a wrapper on the post template, use the HubL variable {{ page_meta.name }} instead. 

 

  • Click Publish changes.
 
0件の返信

0 コメント

この投稿にはまだ回答がありません

この投稿にはまだ回答が寄せられていません。しばらく経ってからもう一度ご確認ください。また、役に立つ情報をご存じの場合はぜひ回答を投稿してください。

投稿に回答する

回答の仕方についてご不明な場合は、コミュニティーのガイドラインをご覧ください。