Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#51016 new enhancement

Video and image schemas support

Reported by: constructivemedia's profile constructivemedia Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version: 5.5
Component: Sitemaps Keywords:
Focuses: Cc:

Description

Proposal to allow for image and video schema types within class-wp-sitemaps-renderer.php.

Allowing for more schemas to be added to urlset ( xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1")

When $url_list contains a image/video child node:

<?php
$parent = $url->addChild( $name, '', 'http://www.google.com/schemas/sitemap-image/1.1' );
foreach ( $value as $child_name => $child_value ) {
    $parent->addChild( $child_name, esc_xml( $child_value ) );
}

Proposed $sitemap_entry structure:

<?php
$sitemap_entry = array(
    'loc'     => home_url('/') . $listing->slug,
    'image' => array(
        'loc' => 'http://example.com/image.jpg'
    ),
    'video' => array(
        'thumbnail_loc' => 'http://www.example.com/thumbs/123.jpg'
    )
);

Change History (1)

#1 @swissspidy
4 years ago

For referene we had lots of discussions about the API design for this at https://github.com/GoogleChromeLabs/wp-sitemaps/issues/151

Note: See TracTickets for help on using tickets.