Set a default featured image on your HubSpot site

    Difficulty Level: Advanced. This post assumes a strong understanding of HubSpot tools and technical knowledge. Insutructions are given as guidelines and may require additional customisation.

    Sometimes you might not necessarily want to add featured images to all of your pages or blog posts, but you don't want it to default to the first image on the page when shared elsewhere. 

    You can set a default og:image tag on your template by adding this snippet to the <head> section of your template: 

    {% if !content.featured_image %}
    <meta property="og:image" content="https://www.yourdomain.com/hubfs/yourimage.jpg" />
    {% endif %}

    It will check whether a Featured Image has been added and, if not, add an og:image tag to the head with the image you've entered above. 

    Last Updated: September 24, 2019

    Thank you! I appreciate the feedback 😊

    Sorry to hear that! 🙁

    I'd appreciate if you could take a moment to let me know how I can improve this article.

    💻

    Looking for a HubSpot website developer?

    I can help you with website themes, templates, page setup and custom modules. 

    Get in touch

    Stephanie O'Gay Garcia

    Hi! 👋 I'm a freelance HubSpot Website Designer & Developer based in Toronto (Canada). Give me a shout if you have questions about this post or there's anything I can help you with.