seed
When building a site with Open Graph and Twitter Card meta tags, you can verify they’re rendering correctly before publishing using curl and grep.
The Command
curl -s http://localhost:1313/your-page/ | grep -E "(og:image|twitter:image)"
Example Output
For a page with an image in the content:
<meta name="twitter:image" content="http://localhost:1313/images/some-image.png" />
<meta property="og:image" content="http://localhost:1313/images/some-image.png" />
For a page falling back to the site default:
<meta name="twitter:image" content="http://localhost:1313/images/mbbrobergfun.png" />
<meta property="og:image" content="http://localhost:1313/images/mbbrobergfun.png" />
Checking Other Meta Tags
Expand the grep pattern to see more:
# All Open Graph tags
curl -s http://localhost:1313/ | grep "og:"
# All Twitter tags
curl -s http://localhost:1313/ | grep "twitter:"
# Title and description
curl -s http://localhost:1313/ | grep -E "(og:title|og:description|twitter:title|twitter:description)"
Testing with Preview Tools
For full visual previews, you need a public URL. Use a tunnel:
hugo serve &
ngrok http 1313
Then paste the ngrok URL into:
This is an entry in my digital garden. See what else is growing here.