Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Open Graph & Twitter Card Tags | HTML Course lesson | BraveProgrammer
  1. Courses
  2. /
  3. HTML Course

Lesson 25 of 55

·HTML

Open Graph & Twitter Card Tags

9 min

Course progress45%

What you'll learn

Keep these ideas in mind as you work through the lesson.

5 points
  • Open Graph properties (`og:title`, `og:description`, `og:image`, `og:url`, `og:type`)
  • Twitter Card meta tags and their required fields
  • Image size recommendations for optimal social previews
  • Testing Open Graph and Twitter Card markup with official debuggers
  • Maintaining consistent branding across social platforms

Social Media Rich Previews

<meta property='og:title' content='My Portfolio' />
<meta property='og:description' content='Front‑end developer showcasing projects.' />
<meta property='og:image' content='https://example.com/preview.png' />
<meta property='og:url' content='https://example.com/' />
<meta property='og:type' content='website' />
<meta name='twitter:card' content='summary_large_image' />
<meta name='twitter:title' content='My Portfolio' />
<meta name='twitter:description' content='Front‑end developer portfolio.' />
<meta name='twitter:image' content='https://example.com/preview.png' />
<meta name='twitter:image:alt' content='Screenshot of portfolio homepage' />

Image guidelines

  • Use 1200 × 630 px for optimal display on Facebook and Twitter.
  • Keep the image under 5 MB to avoid timeout errors.
  • Provide a descriptive twitter:image:alt for accessibility.

Testing tools

  • Facebook Sharing Debugger – Refreshes the cache and shows parsed OG tags.
  • Twitter Card Validator – Previews how the card will appear on Twitter.
  • Meta Tag Analyzer (various online tools) can check completeness.

Quick checklist for social meta tags

  1. Open Graph tags (og:title, og:description, og:image, og:url, og:type) present? ✅
  2. Twitter Card tags present (twitter:card, twitter:title, twitter:description)? ✅
  3. Image size follows 1200 × 630 px recommendation? ✅
  4. twitter:image:alt provided for accessibility? ✅
  5. Tested with Facebook and Twitter debuggers? ✅

Tip: Keep the Open Graph data consistent across pages for a cohesive brand presence on social platforms.

Make it stickPractice what you've learned1 quiz · 2 practical tests · Optional activities from HTML CourseBrowse activities
Previous lessonMetadata – Charset, Viewport, HTTP‑EquivContinue to lesson 26Web Fonts – Google Fonts & @font-faceBack to HTML Course curriculum