← CodeClarityLab Home
Browse by Category
+ added · updated 7d
← Back to glossary

HTML Meta Tags & SEO

frontend PHP 5.0+ Beginner

Also Known As

meta description Open Graph canonical URL structured data JSON-LD

TL;DR

Essential meta tags for search engine visibility and social sharing — title, description, canonical, Open Graph, Twitter Card, and structured data.

Explanation

Key meta tags: title (50-60 chars, unique per page), meta description (150-160 chars, compelling summary), meta robots (index/noindex, follow/nofollow), canonical (prevents duplicate content penalties), Open Graph (og:title, og:description, og:image — for Facebook/LinkedIn sharing), Twitter Card (twitter:card, twitter:image), and lang attribute on html element. Structured data (JSON-LD with Schema.org) enables rich snippets in search results — FAQPage, Product, Article, BreadcrumbList. Each PHP page template should generate unique, meaningful meta tags dynamically.

Common Misconception

Meta keywords still matter for SEO — Google has ignored the meta keywords tag since 2009; focus on quality content, title, description, and structured data instead.

Why It Matters

Missing canonical tags cause duplicate content penalties when the same product appears at multiple URLs — a single missing meta tag can halve a page's search ranking.

Common Mistakes

  • Same meta description on every page — each page needs a unique, descriptive description.
  • Missing canonical tag on paginated pages — /products?page=2 competes with /products.
  • Open Graph image not specified — social shares show a blank or incorrect image.
  • Title tag over 60 characters — truncated in search results.

Code Examples

✗ Vulnerable
<!-- Static/missing meta — same on every page:
<title>My Website</title>
<!-- No meta description -->
<!-- No canonical -->
<!-- No Open Graph -->
✓ Fixed
<!-- Dynamic meta in PHP template:
<title><?= esc($page->title) ?> | CodeClarityLab</title>
<meta name="description" content="<?= esc($page->description) ?>">
<link rel="canonical" href="<?= esc($page->canonicalUrl) ?>">

<!-- Open Graph:
<meta property="og:title" content="<?= esc($page->title) ?>">
<meta property="og:description" content="<?= esc($page->description) ?>">
<meta property="og:image" content="<?= esc($page->ogImage) ?>">
<meta property="og:type" content="article">

<!-- Structured data:
<script type="application/ld+json">
<?= json_encode(['@context'=>'https://schema.org','@type'=>'Article','name'=>$page->title]) ?>
</script>

Added 16 Mar 2026
Edited 22 Mar 2026
Views 40
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings W 0 pings T 0 pings F 0 pings S 0 pings S 0 pings M 2 pings T 1 ping W 0 pings T 0 pings F 1 ping S 0 pings S 0 pings M 0 pings T 1 ping W 0 pings T 0 pings F 3 pings S 0 pings S 0 pings M 0 pings T 0 pings W 0 pings T 1 ping F 1 ping S 0 pings S 0 pings M 1 ping T 0 pings W 0 pings T
No pings yet today
No pings yesterday
Perplexity 9 Amazonbot 8 Google 4 SEMrush 3 Unknown AI 2 Ahrefs 2 Majestic 1
crawler 29
DEV INTEL Tools & Severity
🟡 Medium ⚙ Fix effort: Low
⚡ Quick Fix
Set a unique <title> and <meta name='description'> on every PHP-rendered page; add Open Graph tags for social sharing; use canonical URLs to prevent duplicate content
📦 Applies To
PHP 5.0+ web
🔗 Prerequisites
🔍 Detection Hints
Same <title> on all pages; missing meta description; no Open Graph tags; duplicate content on multiple URLs without canonical
Auto-detectable: ✓ Yes lighthouse google-search-console screaming-frog
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: Low Context: File

✓ schema.org compliant