Meta Tag Generator: how it works and how to build one
SEO, Open Graph and Twitter meta tags with a live preview. This guide explains what happens behind the button and shows the code, so you can build your own.
What it does
Fill in the title, description, URL and image to get all the meta tags a page needs: SEO, canonical, Open Graph for WhatsApp, LinkedIn and Facebook, and Twitter cards. Length counters and a Google and social preview help you get it right.
When to use it
- New pages and blog posts
- Fixing ugly link previews on WhatsApp
- SEO audits
How to use it
- Fill in the page details.
- Check the previews and length counters.
- Copy the tags into your page’s <head>.
Try it free in your browser, nothing is uploaded: https://eskillsfy.com/tools/meta-tag-generator
How it works
Search engines read <title> and <meta name=”description”>. Social apps read Open Graph tags (og:title, og:image) and Twitter card tags. The generator fills a template with your values, escaping quotes and < so the HTML stays valid.
The previews mimic how Google and social apps lay out the result and cut long text, which is why the length counters matter.
Build it yourself
Here is the core of the tool. It has no dependencies unless noted, so you can paste it into any TypeScript or JavaScript project.
metaTags.ts (ts)
const esc = (s: string) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<");
export const metaTags = (m: { title: string; desc: string; url: string; image: string }) => `
<title>${esc(m.title)}</title>
<meta name="description" content="${esc(m.desc)}">
<link rel="canonical" href="${esc(m.url)}">
<meta property="og:title" content="${esc(m.title)}">
<meta property="og:description" content="${esc(m.desc)}">
<meta property="og:image" content="${esc(m.image)}">
<meta property="og:url" content="${esc(m.url)}">
<meta name="twitter:card" content="summary_large_image">`.trim();
Make it production-ready
- Fetch an existing URL’s tags server-side to audit them.
- In Next.js, return the same fields from generateMetadata instead.
Questions
What image size should I use?
1200 × 630 pixels. The Banner & Social Card Maker on Eskillsfy makes one.
Free, runs in your browser, nothing is uploaded.