-
-
Notifications
You must be signed in to change notification settings - Fork 1
Meta Tags Reference
Comprehensive guide to all meta tags generated by the PHP-SEO package, including HTML standards, Open Graph, Twitter Cards, and other structured metadata.
The PHP-SEO package generates a complete set of meta tags for optimal SEO and social media sharing. All tags are generated based on content analysis and configuration settings.
<title>Page Title - Site Name</title>
<meta name="description" content="Page description for search engines">
<meta name="keywords" content="keyword1, keyword2, keyword3">
<meta name="author" content="Author Name">
<meta name="language" content="en">
<meta name="robots" content="index, follow"><meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes"><meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
<meta name="referrer" content="strict-origin-when-cross-origin">Open Graph tags enable rich sharing on social platforms like Facebook, LinkedIn, and others.
<meta property="og:type" content="website">
<meta property="og:title" content="Page Title">
<meta property="og:description" content="Page description">
<meta property="og:url" content="https://example.com/page">
<meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:site_name" content="Site Name">
<meta property="og:locale" content="en_US"><meta property="og:type" content="article">
<meta property="article:author" content="Author Name">
<meta property="article:published_time" content="2024-01-01T00:00:00Z">
<meta property="article:modified_time" content="2024-01-02T00:00:00Z">
<meta property="article:section" content="Technology">
<meta property="article:tag" content="SEO">
<meta property="article:tag" content="Meta Tags"><meta property="og:image" content="https://example.com/image.jpg">
<meta property="og:image:alt" content="Image description">
<meta property="og:image:width" content="1200">
<meta property="og:image:height" content="630">
<meta property="og:image:type" content="image/jpeg">Twitter Cards provide rich previews when links are shared on Twitter.
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@website">
<meta name="twitter:creator" content="@author">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Page description">
<meta name="twitter:image" content="https://example.com/image.jpg">
<meta name="twitter:image:alt" content="Image description"><meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@website">
<meta name="twitter:title" content="Page Title">
<meta name="twitter:description" content="Page description">
<meta name="twitter:image" content="https://example.com/large-image.jpg">
<meta name="twitter:image:alt" content="Large image description">JSON-LD structured data for enhanced search results.
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Article",
"headline": "Article Title",
"description": "Article description",
"author": {
"@type": "Person",
"name": "Author Name"
},
"datePublished": "2024-01-01",
"dateModified": "2024-01-02",
"image": "https://example.com/image.jpg",
"publisher": {
"@type": "Organization",
"name": "Publisher Name",
"logo": {
"@type": "ImageObject",
"url": "https://example.com/logo.jpg"
}
}
}
</script><script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "Website Name",
"url": "https://example.com",
"description": "Website description",
"potentialAction": {
"@type": "SearchAction",
"target": "https://example.com/search?q={search_term_string}",
"query-input": "required name=search_term_string"
}
}
</script>Control how search engines crawl and index your content.
<meta name="robots" content="index, follow">
<meta name="robots" content="noindex, nofollow">
<meta name="robots" content="index, nofollow">
<meta name="robots" content="noindex, follow"><meta name="robots" content="index, follow, noarchive">
<meta name="robots" content="index, follow, nosnippet">
<meta name="robots" content="index, follow, noimageindex">
<meta name="robots" content="index, follow, max-snippet:160">
<meta name="robots" content="index, follow, max-image-preview:large">
<meta name="robots" content="index, follow, max-video-preview:30"><meta name="googlebot" content="index, follow">
<meta name="bingbot" content="index, follow">
<meta name="slurp" content="index, follow">use Rumenx\PhpSeo\Config\SeoConfig;
$config = new SeoConfig([
'meta_tags' => [
'robots' => [
'index' => true,
'follow' => true,
'archive' => false
],
'open_graph' => [
'enabled' => true,
'site_name' => 'My Website',
'locale' => 'en_US'
],
'twitter' => [
'enabled' => true,
'site' => '@mywebsite',
'card_type' => 'summary_large_image'
]
]
]);$config = new SeoConfig([
'meta_tags' => [
'generator' => 'PHP-SEO Package',
'copyright' => '© 2024 My Company',
'rating' => 'general',
'distribution' => 'global',
'revisit_after' => '7 days',
'robots' => [
'index' => true,
'follow' => true,
'archive' => false,
'snippet' => true,
'imageindex' => true,
'max_snippet' => 160,
'max_image_preview' => 'large'
],
'verification' => [
'google' => 'google-verification-code',
'bing' => 'bing-verification-code',
'yandex' => 'yandex-verification-code'
]
]
]);use Rumenx\PhpSeo\SeoManager;
$seo = new SeoManager($config);
$content = '<h1>My Page</h1><p>Page content...</p>';
$metaTags = $seo->analyze($content, [
'title' => 'Page Title',
'description' => 'Page description',
'url' => 'https://example.com/page',
'image' => 'https://example.com/image.jpg'
])->generateMetaTags();
echo $seo->renderMetaTags($metaTags);$customMeta = [
'author' => 'John Doe',
'copyright' => '© 2024 My Company',
'keywords' => ['seo', 'meta tags', 'optimization']
];
$metaTags = $seo->generateMetaTags($customMeta);$config = new SeoConfig([
'meta_tags' => [
'open_graph' => [
'enabled' => $isArticle, // Only for articles
],
'twitter' => [
'enabled' => $hasTwitterAccount,
]
]
]);- Keep under 60 characters
- Include primary keyword
- Make it unique and descriptive
- Include brand name when appropriate
- Keep between 150-160 characters
- Include primary and secondary keywords
- Make it compelling and actionable
- Unique for each page
- Use 1200x630 pixels for best results
- Keep file size under 8MB
- Use high-quality, relevant images
- Include alt text for accessibility
- Choose appropriate card type
- Test with Twitter Card Validator
- Include proper attribution
- Optimize images for mobile viewing
- Be specific about crawling instructions
- Use noindex for duplicate or thin content
- Consider nofollow for untrusted links
- Test impact on search visibility
// Validate generated meta tags
$validator = new MetaTagValidator();
$issues = $validator->validate($metaTags);
foreach ($issues as $issue) {
echo "Warning: {$issue->getMessage()}\n";
}-
Missing Open Graph Images
- Ensure image URLs are absolute
- Check image dimensions and file size
- Verify image accessibility
-
Invalid Twitter Cards
- Use Twitter Card Validator
- Check card type compatibility
- Verify required fields
-
Robots Tag Conflicts
- Avoid conflicting directives
- Check robots.txt alignment
- Test crawl accessibility
$config = new SeoConfig([
'debug' => true,
'meta_tags' => [
'validation' => true
]
]);
// Will output validation warnings
$metaTags = $seo->generateMetaTags();This comprehensive meta tags reference ensures your content is properly optimized for search engines and social media platforms.