blanket11
5/19/2017 - 11:42 AM

[wordpress] AMPプラグインのpublisher logoの書き換え設定

[wordpress] AMPプラグインのpublisher logoの書き換え設定

add_filter( 'amp_post_template_metadata', 'custom_amp_modify_json_metadata', 10, 2 );

function custom_amp_modify_json_metadata( $metadata, $post ) {
    $metadata['@type'] = 'NewsArticle';

    // AMPサイトアイコンの設定
    $metadata['publisher']['logo'] = array(
        '@type' => 'ImageObject',
        'url' => 'https://hoge.fuga/image/favicon.ico',
        'height' => 64,
        'width' => 64,
    );

    return $metadata;
}