OG Preview Tool

Guides › Frameworks & CMS

How to add Open Graph tags in Hugo

Hugo ships built-in Open Graph and Twitter card templates. In your <head> partial:

{{ partial "opengraph.html" . }}
{{ partial "twitter_cards.html" . }}

{{/* Older Hugo versions: */}}
{{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }}

The templates read title, description and images from front matter (falling back to params.images in site config). Set baseURL correctly so image URLs are absolute.

---
title: My post
description: One-sentence summary
images: ['/og/my-post.png']
---

Verify

Deploy, then run the live URL through the OG previewer. It fetches the page like a social crawler (no JavaScript), so tags added only on the client side won't show up. That matches what Facebook, LinkedIn and X see.

Preview your link now

Related

How to add Open Graph tags in Next.jsHow to add Open Graph tags in NuxtHow to add Open Graph tags in AstroHow to add Open Graph tags in WordPressHow to add Open Graph tags in ShopifyHow to add Open Graph tags in SvelteKit

More free tools from Swift Labs

Robots & Sitemap Checker
Validate robots.txt and XML sitemaps, test any path, see which AI crawlers you block.
Email DNS Check
Check SPF, DKIM, DMARC and MX records in seconds.
DeadLinkPatrol
Find broken links across your whole site.