{"id":355,"date":"2026-07-10T10:12:39","date_gmt":"2026-07-10T10:12:39","guid":{"rendered":"https:\/\/tools.dwiyanti.com\/blog\/?p=355"},"modified":"2026-07-10T10:12:40","modified_gmt":"2026-07-10T10:12:40","slug":"schema-item-list","status":"publish","type":"post","link":"https:\/\/tools.dwiyanti.com\/blog\/schema-item-list","title":{"rendered":"Schema Item List"},"content":{"rendered":"<pre style=\"white-space:pre-wrap;\">\nDARI SCHEMA PORTFOLIO HTTPS:\/\/ME.DWIYANTI.COM tapi sudah di hapus\n---\n\/* Schema ItemList untuk bagian postingan terbaru (sebagai bagian dari WebPage) *\/\nadd_action( 'wp_head', 'homepage_webpage_with_itemlist' );\n\nfunction homepage_webpage_with_itemlist() {\n    if ( ! is_front_page() ) {\n        return;\n    }\n\n    $site_name = get_bloginfo( 'name' );\n    $site_url = home_url();\n    $site_description = get_bloginfo( 'description' );\n    $homepage_title = get_the_title( get_option( 'page_on_front' ) );\n\n    $recent_posts = get_posts( array(\n        'numberposts' => 6,\n        'post_status' => 'publish',\n        'post_type'   => 'post'\n    ) );\n\n    $item_list = array();\n    $position = 1;\n\n    foreach ( $recent_posts as $post ) {\n        \/\/ Setup post data untuk fungsi get_the_excerpt()\n        setup_postdata( $post );\n\n        \/\/ Dapatkan excerpt yang benar\n        $excerpt = get_the_excerpt();\n        if ( empty( $excerpt ) ) {\n            $excerpt = wp_trim_words( $post->post_content, 55 );\n        }\n\n        $item_list[] = array(\n            '@type' => 'ListItem',\n            'position' => $position,\n            'url' => get_permalink( $post->ID ),\n            'name' => esc_html( get_the_title( $post->ID ) ),\n            'description' => esc_html( wp_trim_words( $excerpt, 20 ) )\n        );\n        $position++;\n    }\n\n    wp_reset_postdata(); \/\/ Kembalikan global $post\n\n    \/\/ SATU SCHEMA dengan tipe WebPage\n    \/\/ Tapi di dalamnya ada mainEntity berupa ItemList\n    $schema = array(\n        '@context' => 'https:\/\/schema.org',\n        '@type' => 'WebPage',  \/\/ \u2190 karena ini PAGE (homepage statis)\n        '@id' => $site_url . '\/#webpage',\n        'url' => $site_url,\n        'name' => get_the_title( get_option( 'page_on_front' ) ),\n        'description' => $site_description ? $site_description : 'Beranda ' . $site_name,\n        'isPartOf' => array(\n            '@type' => 'WebSite',\n            '@id' => $site_url . '\/#website',\n            'name' => get_bloginfo( 'name' )\n        ),\n        'mainEntity' => array(  \/\/ \u2190 tambahan: ini menjelaskan isi utama halaman\n            '@type' => 'ItemList',\n            'name' => 'Artikel Terbaru',\n            'itemListElement' => $item_list,\n            'numberOfItems' => count( $recent_posts )\n        )\n    );\n\n    echo '<script type=\"application\/ld+json\">' . \"\\n\";\n    echo json_encode( $schema, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT );\n    echo \"\\n\" . '<\/script>' . \"\\n\";\n}\n\/\/ END Schema ItemList\n<\/pre>","protected":false},"excerpt":{"rendered":"DARI SCHEMA PORTFOLIO HTTPS:\/\/ME.DWIYANTI.COM tapi sudah di hapus &#8212; \/* Schema ItemList untuk bagian postingan terbaru (sebagai bagian dari WebPage) *\/ add_action( &#8216;wp_head&#8217;, &#8216;homepage_webpage_with_itemlist&#8217; ); function homepage_webpage_with_itemlist() { if ( ! is_front_page() ) { return; } $site_name = get_bloginfo( &#8216;name&#8217; ); $site_url = home_url(); $site_description = get_bloginfo( &#8216;description&#8217; ); $homepage_title = get_the_title( get_option( &#8216;page_on_front&#8217; ) [&hellip;]","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-355","post","type-post","status-publish","format-standard","hentry","category-schema"],"_links":{"self":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/355","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=355"}],"version-history":[{"count":1,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/355\/revisions"}],"predecessor-version":[{"id":356,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/posts\/355\/revisions\/356"}],"wp:attachment":[{"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/media?parent=355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/categories?post=355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tools.dwiyanti.com\/blog\/wp-json\/wp\/v2\/tags?post=355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}