Add Facebook Open Graph Meta Tags to Blogger
In this article
Yes, you can add Facebook Open Graph (OG) meta tags to a Blogger blog to control how your content appears when shared on Facebook. Without these tags, shared links may display incorrect or unappealing titles, images, or descriptions. By adding OG tags to your Blogger template, you ensure that each post shows a clear title, a relevant image, and a compelling description when shared. This guide walks you through the exact steps to edit your Blogger HTML template safely and effectively.
What You'll Need
- A Blogger account with an active blog
- Access to the blog's Theme settings (you must be an admin)
- A working backup of your current theme (recommended before editing)
- A text editor or browser with copy-paste capability
Step-by-Step
- Log in to your Blogger dashboard and select the blog you want to edit.
- In the left-hand menu, click Theme, then click Edit HTML near the top right of the theme preview.
- Wait for the HTML editor to load. This may take a few seconds. The full template code will appear in a large text box.
- Use Ctrl+F (or Cmd+F on Mac) to search for the
<head>tag. This marks the start of the page header section. - Just below the
<head>tag, paste the following Open Graph meta tags exactly as shown:
<!-- Open Graph Meta Tags for Blogger --> <meta expr:content='data:blog.pageName' property='og:title'/> <meta expr:content='data:blog.canonicalUrl' property='og:url'/> <meta expr:content='data:blog.pageType == "item" ? data:blog.metaDescription : data:blog.title' property='og:description'/> <meta content='your-blog-name' property='og:site_name'/> <meta content='article' property='og:type'/> <meta expr:content='data:blog.postImageUrl' property='og:image' /> <meta content='your-app-id' property='fb:app_id'/>
- Replace
your-blog-namewith the actual name of your blog (e.g.,My Travel Journal). Keep the quotes. - If you have a Facebook App ID (from creating a Facebook Developer app), replace
your-app-idwith it. If not, you can leave this line out or keep it blank—Facebook will still read the other tags. - Ensure all tags are placed before any other
<meta>tags that might conflict (like Twitter Card tags). It’s safest to keep them right after<head>. - Click Save Theme to apply the changes.
- To test, share a blog post link directly into a Facebook status update or use the Facebook Sharing Debugger. The tool will show how the link appears and whether all tags are detected.
Common Mistakes
- Placing tags in the wrong section: Putting OG tags inside
<body>or after other scripts prevents Facebook from reading them. Always place them inside<head>. - Forgetting to replace placeholders: Leaving
your-blog-nameoryour-app-idunchanged results in incomplete or missing data. - Using hardcoded image URLs: Setting a single image URL instead of
data:blog.postImageUrlmeans every post shares the same image, even if the post has a different featured image. - Overwriting instead of inserting: Accidentally deleting existing
<meta>tags while pasting new ones can break SEO. Always paste new code without removing essential tags. - Not testing after save: Without testing via Facebook’s debugger, you won’t know if the tags are parsed correctly.
Tips
- Use
data:blog.postImageUrlto dynamically pull the first image from each post. This ensures the correct image appears for each shared link. - If your blog uses a custom favicon or SEO plugin, review their code first to avoid duplicate meta tags.
- For blogs with multiple authors, ensure all posts have a meta description set—this becomes the
og:descriptionfallback. - Consider adding
og:localeif your blog targets a specific region (e.g.,en_US). - Keep a backup of your original theme code in a text file. If something breaks, you can restore it quickly.
Troubleshooting
If your Open Graph tags aren’t working, follow these steps in order:
- Check for typos: Verify all property names (e.g.,
og:title,og:image) are spelled correctly and match Facebook’s required format. - Use the Facebook Sharing Debugger: Enter your blog post URL. The tool will show any errors, such as missing images or unscraped data. Click Scrape Again after fixing issues.
- Confirm image size and format: Facebook requires images to be at least 200px by 200px. Larger images (1200x630px) are recommended. Ensure images are in JPG, PNG, or GIF format and hosted publicly (not blocked by robots.txt).
- Clear Facebook’s cache: Facebook caches shared links. Use the debugger tool to force a fresh scrape—do not rely on previous shares.
- Check template syntax: If the blog fails to load after editing, you may have broken HTML. Restore from backup and re-paste the tags carefully.
- Verify post images: If
data:blog.postImageUrlreturns nothing, ensure each post has a featured image or the first image is not hidden.
Frequently Asked Questions
Do I need a Facebook App ID for Open Graph tags to work?
No. While fb:app_id helps with analytics and app integration, the core Open Graph tags (title, URL, image, description) work without it.
Why is the wrong image showing when I share my post?
Facebook picks the first image it finds. If data:blog.postImageUrl isn’t detected, it may grab a sidebar or logo image. Ensure each post has a clear, early-placed image.
Can I customize the OG tag for static pages like About or Contact?
Yes. You can add conditional logic in the template to show different tags for non-post pages, but this requires advanced HTML editing and knowledge of Blogger’s data tags.
Will these tags improve my blog’s SEO?
Directly, no—OG tags don’t affect Google search rankings. But better-looking shares on Facebook can drive more traffic, indirectly benefiting visibility.
What happens if I don’t add Open Graph tags?
Facebook will still generate a preview, but it may use incorrect titles, random images, or truncated text, making your content look unprofessional.
Can I use the same method for Twitter Cards?
No. Twitter uses its own meta tags (like twitter:card). You need to add separate tags for Twitter, though they can coexist in the same <head> section.