Skip to content

Integration with SEOMatic

Helge Sverre edited this page Jan 19, 2019 · 1 revision

To override SEOMatic meta tags with Hubspot fields, place the following in the template for your blog post entry.

{% do seomatic.meta.setAttributes({
            seoTitle: post.html_title,
            seoDescription: post.post_summary | default('') | raw,
            seoKeywords: post.keywords,
            seoImage: post.featured_image,
            canonicalUrl: siteUrl,
            twitter: {
                card: "summary_large_image",
                site: siteUrl,
                title: post.html_title,
                description: post.post_summary | default('') | raw,
                image: post.featured_image
            },
            og: {
                type: "article",
                locale: "en_GB",
                url: siteUrl,
                title: post.html_title,
                description: post.post_summary | default('') | raw,
                image: post.featured_image,
            }
        }) %}

Note: You might have to clear the craft cache to see changes, as SEOMatic caches its meta tags. https://github.com/nystudio107/craft-seomatic/issues/298

Clone this wiki locally