{"id":297,"date":"2026-06-19T12:16:49","date_gmt":"2026-06-19T12:16:49","guid":{"rendered":"https:\/\/tools.dwiyanti.com\/blog\/?p=297"},"modified":"2026-06-19T12:19:00","modified_gmt":"2026-06-19T12:19:00","slug":"schema-di-blog-dwiyanti-com","status":"publish","type":"post","link":"https:\/\/tools.dwiyanti.com\/blog\/schema-di-blog-dwiyanti-com","title":{"rendered":"Schema di Blog DwiYanti.com"},"content":{"rendered":"<pre style=\"white-space:pre-wrap;\">\n\n\nSchema Website sebelum perubahan\n\n\/\/ Schema Markup Website utk frontpage\nfunction add_front_page_schema()\n{\n    if (is_home() || is_front_page()) {\n        global $post;\n\n        $url = home_url();\n        $site_name = get_bloginfo('name');\n        $description = get_bloginfo('description');\n\n        \/\/ Ambil konten halaman front-page\n        $content = isset($post->post_content) ? $post->post_content : '';\n\n        $images = [];\n\n        \/\/ Ambil hingga 3 gambar dari konten front page\n        preg_match_all('\/<img[^>]+src=[\"\\']([^\"\\']+)[\"\\']\/i', $content, $matches);\n        if (!empty($matches[1])) {\n            $max = 3;\n            $count = 0;\n            foreach ($matches[1] as $img_url) {\n                $images[] = [\n                    \"@type\" => \"ImageObject\",\n                    \"url\" => $img_url,\n                    \"width\" => 1200,\n                    \"height\" => 630\n                ];\n                $count++;\n                if ($count >= $max) break;\n            }\n        }\n\n        \/\/ Fallback kalau tidak ada gambar\n        if (empty($images)) {\n            $images[] = [\n                \"@type\" => \"ImageObject\",\n                \"url\" => get_site_icon_url(),\n                \"width\" => 512,\n                \"height\" => 512\n            ];\n        }\n\n        $schema = [\n            \"@context\" => \"https:\/\/schema.org\",\n            \"@graph\" => [\n                [\n            \"@type\" => \"WebSite\",\n            \"url\" => $url,\n            \"name\" => $site_name,\n            \"description\" => $description,\n            \"publisher\" => [\n                \"@type\" => \"Organization\",\n                \"name\" => \"Dwi Yanti SEO\",\n                \"alternateName\" => \"Dwi Yanti SEO Specialist & Technical SEO Strategist\",\n                \"logo\" => [\n                    \"@type\" => \"ImageObject\",\n                    \"url\" => get_site_icon_url()\n                ]\n            ],\n            \"image\" => $images,\n            \"author\"   => [\n                \"@type\" => \"Person\",\n                \"@id\"   => \"https:\/\/me.dwiyanti.com\/#dwi-yanti\",\n                \"name\"  => \"Dwi Yanti\",\n                \"alternateName\" => [\"DwiYanti\", \"dwynti\", \"dwee\"],\n                \"url\" => \"https:\/\/dwiyanti.com\/author\/dwi-yanti\",\n                \"gender\"      => \"Female\",\n                \"jobTitle\"    => \"SEO Specialist & Technical SEO Strategist\",\n                \"nationality\" => [\n                    \"@type\" => \"Country\",\n                    \"name\"  => \"Indonesia\"\n                ],\n                \"image\" => [\n                    [\n                        \"@type\" => \"ImageObject\",\n                        \"contentUrl\" => \"https:\/\/me.dwiyanti.com\/wp-content\/themes\/dwee\/assets\/images\/dwi-yanti-seo-specialist.jpg\",\n                        \"width\"  => 1200,\n                        \"height\" => 1200,\n                        \"caption\" => \"Dwi Yanti \u2014 SEO Specialist & Technical SEO Strategist Jakarta\"\n                    ],\n                    [\n                        \"@type\" => \"ImageObject\",\n                        \"contentUrl\" => \"https:\/\/me.dwiyanti.com\/wp-content\/themes\/dwee\/assets\/images\/Dwi-Yanti-Achieve-Rank-1-Google-SERP.jpg\",\n                        \"width\"  => 1200,\n                        \"height\" => 630,\n                        \"caption\" => \"Dwi Yanti \u2014 Rank 1 Google SEO Specialist\"\n                    ],\n                    [\n                        \"@type\" => \"ImageObject\",\n                        \"contentUrl\" => \"https:\/\/me.dwiyanti.com\/wp-content\/themes\/dwee\/assets\/images\/Dwi-Yanti-Achieve-Bing-Copilot.jpg\",\n                        \"width\"  => 1200,\n                        \"height\" => 630,\n                        \"caption\" => \"Dwi Yanti cited in Bing Copilot as SEO Specialist\"\n                    ],\n                    [\n                        \"@type\" => \"ImageObject\",\n                        \"contentUrl\" => \"https:\/\/me.dwiyanti.com\/wp-content\/themes\/dwee\/assets\/images\/Dwi-Yanti-Achieve-Google-Overview.jpg\",\n                        \"width\"  => 1200,\n                        \"height\" => 630,\n                        \"caption\" => \"Dwi Yanti appearing in Google AI Overview for SEO Strategist\"\n                    ],\n                    [\n                        \"@type\" => \"ImageObject\",\n                        \"contentUrl\" => \"https:\/\/me.dwiyanti.com\/wp-content\/themes\/dwee\/assets\/images\/Dwi-Yanti-Technical-SEO.jpg\",\n                        \"width\"  => 1200,\n                        \"height\" => 630,\n                        \"caption\" => \"Dwi Yanti \u2014 Technical SEO Strategist\"\n                    ]                    \n                ],\n                \"hasOccupation\" => [\n                    \"@type\" => \"Occupation\",\n                    \"name\"  => \"SEO Specialist\",\n                    \"description\" => \"Technical SEO Strategist executing at both code level and algorithm level.\",\n                    \"occupationLocation\" => [\n                        [\n                            \"@type\" => \"City\",\n                            \"name\"  => \"Jakarta\",\n                            \"containedInPlace\" => [\"@type\" => \"Country\", \"name\" => \"Indonesia\"]\n                        ],\n                        [\n                            \"@type\" => \"Country\",\n                            \"name\"  => \"Worldwide\"\n                        ]\n                    ],\n                    \"skills\" => \"Technical SEO, Pure Coding, PHP, MySQL, HTML, CSS, JavaScript, WordPress, Schema Markup\"\n                ],\n                \"worksFor\" => [\n                    \"@type\" => \"Organization\",\n                    \"@id\"   => \"https:\/\/me.dwiyanti.com\/#organization\",\n                    \"name\"  => \"Dwi Yanti SEO\",\n                    \"alternateName\" => \"Dwi Yanti SEO Specialist & Technical SEO Strategist\",\n                    \"url\"   => \"https:\/\/me.dwiyanti.com\"\n                ],\n                \"sameAs\" => [\n                    \"https:\/\/www.linkedin.com\/in\/dwiyanti\",\n                    \"https:\/\/github.com\/dwynti\",\n                    \"https:\/\/www.fiverr.com\/dwiyanti\",\n                    \"https:\/\/www.upwork.com\/freelancers\/~017da387a20ef99a41\",\n                    \"https:\/\/g.co\/kgs\/v3DRHqN\"\n                ],\n                \"alumniOf\" => [\n                    \"@type\" => \"EducationalOrganization\",\n                    \"name\"  => \"Universitas Jayabaya\"\n                ],\n                \"knowsAbout\" => [\n                    \"Technical SEO\", \"Search Engine Algorithms\", \"Schema Markup\", \"AI Search Optimization\"\n                ],\n                \"knowsLanguage\" => [\n                    [\"@type\" => \"Language\", \"name\" => \"Indonesian\"],\n                    [\"@type\" => \"Language\", \"name\" => \"English\"]\n                ]\n            ],\n            \"creator\" => [\n                \"@type\" => \"Person\",\n                \"name\" => \"Dwi Yanti\",\n                \"@id\" => \"https:\/\/me.dwiyanti.com\/#dwi-yanti\"\n            ]\n            ]\n            ]\n        ];\n\n        echo '<script type=\"application\/ld+json\">' . wp_json_encode($schema) . '<\/script>';\n    }\n}\nadd_action('wp_head', 'add_front_page_schema');\n\/\/ END Schema markup frontpage\n\n\/\/ WebSite + SearchAction Schema (untuk SEO blog\/portofolio kamu)\nfunction add_website_schema_to_head() {\n    ?>\n    <script type=\"application\/ld+json\">\n    {\n      \"@context\": \"https:\/\/schema.org\",\n      \"@graph\": [\n      {\n      \"@type\": \"WebSite\",\n      \"name\": \"Dwi Yanti \u2014 SEO Specialist & Lifestyle Writer\",\n      \"alternateName\": [\"DwiYanti\", \"dwynti\"],\n      \"url\": \"https:\/\/dwiyanti.com\",\n      \"potentialAction\": {\n        \"@type\": \"SearchAction\",\n        \"target\": \"https:\/\/dwiyanti.com\/search?q={search_term_string}\",\n        \"query-input\": \"required name=search_term_string\"\n      },\n      \"author\": {\n        \"@type\": \"Person\",\n        \"@id\": \"https:\/\/me.dwiyanti.com\/#dwi-yanti\",\n        \"name\": \"Dwi Yanti\",\n        \"jobTitle\": \"SEO Specialist & technical SEO Strategist\"\n      },\n      \"creator\": {\n        \"@type\": \"Person\",\n        \"@id\": \"https:\/\/me.dwiyanti.com\/#dwi-yanti\",\n        \"name\": \"Dwi Yanti\",\n        \"jobTitle\": \"SEO Specialist & Technical SEO Strategist\"\n      },\n      \"publisher\": {\n        \"@type\": \"organization\",\n        \"@id\": \"https:\/\/dwiyanti.com\/#organization\",\n        \"name\": \"Dwi Yanti \u2014 SEO Specialist & Lifestyle Writer\",\n        \"logo\": {\n          \"@type\": \"ImageObject\",\n          \"url\": \"https:\/\/dwiyanti.com\/wp-content\/themes\/lifestyle\/assets\/images\/DwiYanti.png\"\n        }\n      }\n      }\n      ]\n    }\n    <\/script>\n    <?php\n}\nadd_action('wp_head', 'add_website_schema_to_head');\n\/\/ END Schema Website \n\n\/\/ Image Object di Page dan single\nfunction add_all_images_schema_universal() {\n    if (!is_single() &#038;&#038; !is_page()) {\n        return;\n    }\n    \n    $content = get_post_field('post_content', get_the_ID());\n    $images = array();\n    \n    \/\/ 1. AMBIL dari tag <img>\n    preg_match_all('\/<img[^>]+src=\"([^\"]+)\"\/i', $content, $matches);\n    if (!empty($matches[1])) {\n        foreach ($matches[1] as $src) {\n            $images[] = $src;\n        }\n    }\n    \n    \/\/ 2. AMBIL dari background-image\n    preg_match_all('\/background-image:\\s*url\\([\\'\"]?([^\\'\"]+)[\\'\"]?\\)\/i', $content, $bg_matches);\n    if (!empty($bg_matches[1])) {\n        foreach ($bg_matches[1] as $src) {\n            $images[] = $src;\n        }\n    }\n    \n    \/\/ Featured image\n    if (has_post_thumbnail()) {\n        $images[] = wp_get_attachment_image_url(get_post_thumbnail_id(), 'full');\n    }\n    \n    \/\/ Hapus duplikat\n    $images = array_unique($images);\n    \n    \/\/ Filter URL valid\n    $images = array_filter($images, function($url) {\n        return filter_var($url, FILTER_VALIDATE_URL) !== false;\n    });\n    \n    if (empty($images)) { \n        return;\n    }\n    \n    $schema_type = is_single ()? 'BlogPosting' || is_page() ? 'WebPage' : 'Website';\n    \n    \/\/ Generate image objects\n    $image_objects = [];\n    foreach ($images as $url) {\n        $image_objects[] = [\n            '@type' => 'ImageObject',\n            'url' => $url\n        ];\n    }\n    \n    \/\/ Batasi maksimal 20 gambar\n    $image_objects = array_slice($image_objects, 0, 20);\n    ?>\n    <script type=\"application\/ld+json\">\n    {\n      \"@context\": \"https:\/\/schema.org\",\n      \"@type\": \"<?php echo $schema_type; ?>\",\n      \"headline\": \"<?php echo esc_js(get_the_title()); ?>\",\n      \"image\": <?php echo json_encode($image_objects, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); ?>\n    }\n    <\/script>\n    <?php\n}\nadd_action('wp_head', 'add_all_images_schema_universal');\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Schema Website sebelum perubahan \/\/ Schema Markup Website utk frontpage function add_front_page_schema() { if (is_home() || is_front_page()) { global $post; $url = home_url(); $site_name = get_bloginfo(&#8216;name&#8217;); $description = get_bloginfo(&#8216;description&#8217;); \/\/ Ambil konten halaman front-page $content = isset($post->post_content) ? $post->post_content : &#8221;; $images = []; \/\/ Ambil hingga 3 gambar dari konten front page preg_match_all(&#8216;\/]+src=[&#8220;\\&#8217;]([^&#8221;\\&#8217;]+)[&#8220;\\&#8217;]\/i&#8217;, $content, [&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-297","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/297","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=297"}],"version-history":[{"count":3,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":300,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/297\/revisions\/300"}],"wp:attachment":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}