{"id":318,"date":"2026-06-28T11:05:08","date_gmt":"2026-06-28T11:05:08","guid":{"rendered":"https:\/\/tools.dwiyanti.com\/blog\/?p=318"},"modified":"2026-06-28T11:05:09","modified_gmt":"2026-06-28T11:05:09","slug":"schema-webpage-deepseek-2","status":"publish","type":"post","link":"https:\/\/tools.dwiyanti.com\/blog\/schema-webpage-deepseek-2","title":{"rendered":"Schema WebPage DeepSeek 2"},"content":{"rendered":"<pre style=\"white-space:pre-wrap;\">\nfunction add_webpage_schema_enhanced() {\n    if (is_front_page() || is_home()) return;\n    if (!is_page()) return;\n    \n    global $post;\n    if ($post->post_title === 'Home' || $post->post_name === 'home') return;\n    \n    \/\/ ========== DATA DASAR ==========\n    $title = get_the_title($post);\n    $url = get_permalink($post);\n    $site_url = home_url();\n    $description = get_optimized_meta_description();\n    $published = get_the_date('c', $post);\n    $modified = get_the_modified_date('c', $post);\n    $site_icon = get_site_icon_url();\n    $in_language = 'id-ID';\n    \n    \/\/ ========== DETEKSI TIPE PAGE ==========\n    $page_type = 'WebPage';\n    $slug = $post->post_name;\n    \n    if (strpos($slug, 'about') !== false || strpos($slug, 'tentang') !== false) {\n        $page_type = 'AboutPage';\n    } elseif (strpos($slug, 'contact') !== false || strpos($slug, 'kontak') !== false) {\n        $page_type = 'ContactPage';\n    } elseif (strpos($slug, 'service') !== false || strpos($slug, 'layanan') !== false) {\n        $page_type = 'ServicePage';\n    } elseif (strpos($slug, 'portfolio') !== false || strpos($slug, 'proyek') !== false) {\n        $page_type = 'CollectionPage';\n    }\n    \n    \/\/ ========== DETEKSI AUTHOR TYPE ==========\n    $is_about_page = ($page_type === 'AboutPage' || strpos($slug, 'team') !== false);\n    $author_type = $is_about_page ? 'Person' : 'Organization';\n    $author_name = $is_about_page ? 'Dwi Yanti' : 'Dwi Yanti SEO';\n    \n    \/\/ ========== AMBIL GAMBAR ==========\n    $images = get_page_images($post);\n    \n    \/\/ ========== DETEKSI TOPIK ==========\n    $topic = detect_page_topic($post);\n    \n    \/\/ ========== SCHEMA WEBPAGE ==========\n    $schema = [\n        \"@context\" => \"https:\/\/schema.org\",\n        \"@graph\" => [\n            [\n                \"@type\" => $page_type,\n                \"@id\" => $url . \"#webpage\",\n                \"url\" => $url,\n                \"name\" => $title,\n                \"headline\" => $title,\n                \"description\" => $description,\n                \"inLanguage\" => $in_language,\n                \"isPartOf\" => [\n                    '@type' => 'WebSite',\n                    '@id' => $site_url . '\/#website',\n                ],\n                \"datePublished\" => $published,\n                \"dateModified\" => $modified,\n                \"dateReviewed\" => $modified,\n                \"image\" => $images,\n                \"primaryImageOfPage\" => $images[0] ?? null,\n                \n                \/\/ Author\/Publisher\n                \"author\" => [\n                    \"@type\" => $author_type,\n                    \"name\" => $author_name,\n                    \"@id\" => $is_about_page ? \"https:\/\/me.dwiyanti.com\/#dwi-yanti\" : $site_url . \"\/#organization\"\n                ],\n                \"publisher\" => [\n                    \"@type\" => \"Organization\",\n                    \"@id\" => $site_url . \"\/#organization\",\n                    \"name\" => \"Dwi Yanti SEO\",\n                    \"logo\" => [\n                        \"@type\" => \"ImageObject\",\n                        \"url\" => $site_icon\n                    ]\n                ],\n                \n                \/\/ ========== SPEAKABLE ==========\n                \"speakable\" => [\n                    '@type' => 'SpeakableSpecification',\n                    'cssSelector' => ['h1', '.entry-content p:first-of-type', '.post-excerpt'],\n                ],\n                \n                \/\/ ========== SEO MODERN ==========\n                \"significantLink\" => get_significant_links(),\n                \"relatedLink\" => get_related_pages(),\n                \"mainContentOfPage\" => substr(wp_strip_all_tags($post->post_content), 0, 300),\n                \n                \/\/ ========== GEO OPTIMIZATION ==========\n                \"about\" => [\n                    \"@type\" => \"Thing\",\n                    \"name\" => $topic ?: \"Digital Marketing & SEO\"\n                ],\n                \"mention\" => get_mentions($post),\n                \"citation\" => [\n                    \"@type\" => \"CreativeWork\",\n                    \"name\" => \"Dwi Yanti SEO Portfolio\",\n                    \"url\" => home_url('\/portfolio\/')\n                ],\n                \n                \/\/ ========== AIO OPTIMIZATION ==========\n                \"educationalUse\" => \"informational\",\n                \"educationalLevel\" => \"All Levels\",\n                \"audience\" => [\n                    \"@type\" => \"Audience\",\n                    \"audienceType\" => get_audience_type($slug)\n                ],\n                \"text\" => wp_strip_all_tags(substr($post->post_content, 0, 1000)),\n                \"potentialAction\" => [\n                    \"@type\" => \"Action\",\n                    \"target\" => $url,\n                    \"name\" => \"Read \" . $title\n                ]\n            ]\n        ]\n    ];\n    \n    \/\/ ========== OUTPUT ==========\n    echo '<script type=\"application\/ld+json\">' . \"\\n\";\n    echo wp_json_encode($schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);\n    echo \"\\n\" . '<\/script>' . \"\\n\";\n}\nadd_action('wp_head', 'add_webpage_schema_enhanced');\n\n\/\/ ========== HELPER FUNCTIONS ==========\nfunction get_page_images($post) {\n    $images = [];\n    \n    \/\/ Featured Image\n    if (has_post_thumbnail($post->ID)) {\n        $image_id = get_post_thumbnail_id($post->ID);\n        $images[] = [\n            \"@type\" => \"ImageObject\",\n            \"url\" => wp_get_attachment_image_url($image_id, 'full'),\n            \"width\" => 1200,\n            \"height\" => 630,\n            \"caption\" => get_post_meta($image_id, '_wp_attachment_image_alt', true)\n        ];\n    }\n    \n    \/\/ Content Images\n    preg_match_all('\/<img[^>]+src=[\"\\']([^\"\\']+)[\"\\']\/i', $post->post_content, $matches);\n    if (!empty($matches[1])) {\n        foreach ($matches[1] as $img_url) {\n            $is_duplicate = array_filter($images, function($img) use ($img_url) {\n                return $img['url'] === $img_url;\n            });\n            if (empty($is_duplicate)) {\n                $images[] = [\n                    \"@type\" => \"ImageObject\",\n                    \"url\" => $img_url,\n                    \"width\" => 1200,\n                    \"height\" => 630\n                ];\n            }\n        }\n    }\n    \n    \/\/ Fallback\n    if (empty($images)) {\n        $images[] = [\n            \"@type\" => \"ImageObject\",\n            \"url\" => \"https:\/\/dwiyanti.com\/wp-content\/themes\/lifestyle\/assets\/images\/DwiYanti.jpeg\",\n            \"width\" => 1200,\n            \"height\" => 630\n        ];\n    }\n    \n    return $images;\n}\n\nfunction detect_page_topic($post) {\n    $content = strtolower($post->post_content);\n    $topics = [\n        'seo' => 'Search Engine Optimization',\n        'digital marketing' => 'Digital Marketing',\n        'web development' => 'Web Development',\n        'content strategy' => 'Content Strategy',\n        'analytics' => 'Web Analytics'\n    ];\n    \n    foreach ($topics as $key => $value) {\n        if (strpos($content, $key) !== false) {\n            return $value;\n        }\n    }\n    return false;\n}\n\nfunction get_significant_links() {\n    return [\n        [\"@type\" => \"WebPage\", \"url\" => home_url('\/about\/')],\n        [\"@type\" => \"WebPage\", \"url\" => home_url('\/services\/')],\n        [\"@type\" => \"WebPage\", \"url\" => home_url('\/portfolio\/')],\n        [\"@type\" => \"WebPage\", \"url\" => home_url('\/contact\/')]\n    ];\n}\n\nfunction get_related_pages() {\n    return [\n        home_url('\/blog\/'),\n        home_url('\/resources\/')\n    ];\n}\n\nfunction get_mentions($post) {\n    $mentions = [];\n    $keywords = ['SEO', 'SEM', 'SMM', 'Content', 'Analytics'];\n    foreach ($keywords as $keyword) {\n        if (strpos($post->post_content, $keyword) !== false) {\n            $mentions[] = [\n                \"@type\" => \"Thing\",\n                \"name\" => $keyword\n            ];\n        }\n    }\n    return array_slice($mentions, 0, 3);\n}\n\nfunction get_audience_type($slug) {\n    if (strpos($slug, 'service') !== false) return 'Business Owners';\n    if (strpos($slug, 'about') !== false) return 'Potential Clients';\n    if (strpos($slug, 'portfolio') !== false) return 'Recruiters & Clients';\n    return 'General Audience';\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function add_webpage_schema_enhanced() { if (is_front_page() || is_home()) return; if (!is_page()) return; global $post; if ($post->post_title === &#8216;Home&#8217; || $post->post_name === &#8216;home&#8217;) return; \/\/ ========== DATA DASAR ========== $title = get_the_title($post); $url = get_permalink($post); $site_url = home_url(); $description = get_optimized_meta_description(); $published = get_the_date(&#8216;c&#8217;, $post); $modified = get_the_modified_date(&#8216;c&#8217;, $post); $site_icon = get_site_icon_url(); $in_language = &#8216;id-ID&#8217;; \/\/ ========== [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-318","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/318","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/comments?post=318"}],"version-history":[{"count":1,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/318\/revisions"}],"predecessor-version":[{"id":319,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/318\/revisions\/319"}],"wp:attachment":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/media?parent=318"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/categories?post=318"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/tags?post=318"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}