--TEST-- extractMetaDescription: returns description from metadata fields or first content paragraph --FILE-- 'SEO description', 'summary' => 'Summary']) . "\n"; // summary is fallback when no search_description echo extractMetaDescription($dir, ['summary' => 'Page summary']) . "\n"; // null metadata, no content files echo (extractMetaDescription($dir, null) ?? 'null') . "\n"; // First paragraph from markdown (skips headings and short lines) file_put_contents("$dir/index.md", "# Title\n\nThis is the opening paragraph of the post.\n\nSecond paragraph."); echo extractMetaDescription($dir, null) . "\n"; unlink("$dir/index.md"); // Heading-only markdown with no usable paragraph file_put_contents("$dir/index.md", "# Just a Heading\n\nShort.\n"); echo (extractMetaDescription($dir, null) ?? 'null') . "\n"; unlink("$dir/index.md"); // First
from HTML file_put_contents("$dir/index.html", "
HTML paragraph text here.
"); echo extractMetaDescription($dir, null) . "\n"; unlink("$dir/index.html"); rmdir($dir); ?> --EXPECT-- SEO description Page summary null This is the opening paragraph of the post. null HTML paragraph text here.