Yoast SEO 开发者文档

title: "Organization" post_status: publish comment_status: open taxonomy: category: - yoast-developer post_tag: - Pieces - Schema - Features


import YoastSchemaExample from '../../../../src/components/YoastSchemaExample';

描述一个组织(公司、企业或机构)。最常用于标识 WebSite 的发布者。

如果满足所需条件,可以转换为更具体的类型(例如 CorporationLocalBusiness)。

触发器

应在所有公开页面上输出。

必需属性

一个有效的 Organization 必须包含以下属性。

失败场景

如果任何必填字段缺失或无效,则不应输出该节点。

如果未输出该节点,任何原本会声明与 Organization 存在关系的实体(例如,作为 WebSitepublisher,或 Productmanufacturer)应移除这些引用。

可选属性

以下属性应在可用且有效时添加:

转换

Organization 类型可能在以下场景中进行转换。

当业务为“本地”时

示例

最低标准

{{ "@context": "https://schema.org", "@graph": [ { "@type": "Organization", "@id": "https://www.example.com/#/schema/Organization/abc123", "url": "https://www.example.com/", "logo": { "@id": "https://www.example.com/uploads/example-image.jpg" }, "name": "示例组织名称" } ] }}

Extended criteria

{{ "@context": "https://schema.org", "@graph": [ { "@type": "Organization", "@id": "https://www.example.com/#/schema/Organization/abc123", "url": "https://www.example.com/", "name": "Example organization name", "alternateName": "Short org name", "sameAs": [ "https://www.wikipedia.com/example-organization", "https://www.linkedin.com/company/1234" ], "logo": { "@id": "https://www.example.com/uploads/example-image.jpg" }, "image": [ { "@id": "https://www.example.com/uploads/example-image.jpg" }, { "@id": "https://www.example.com/uploads/example-image-2.jpg" } ] } ] }}

WordPress API:修改组织架构输出 {#api}

要修改 Yoast SEO 输出的 Organization 架构,您可以使用我们的 wpseo_schema_organization 过滤器。示例如下:

add_filter( 'wpseo_schema_organization', 'change_organization_schema', 11, 2 );

/**
 * 向 Yoast SEO 组织架构添加额外属性
 *
 * @param array             $data    架构组织数据。
 * @param Meta_Tags_Context $context 上下文值对象。
 *
 * @return array $data 架构组织数据。
 */
function change_organization_schema( $data, $context ) {
    $data['@type'] = [
        'Organization',
        'Brand',
    ];
    $data['founder'] = [
        '@type'  => 'Person',
        'name'   => 'Joost de Valk',
        'sameAs' => 'https://en.wikipedia.org/wiki/Joost_de_Valk',
    ];
    $data['foundingDate']       = '2010-05-01';
    $data['numberOfEmployees']  = (int) wp_count_posts( 'yoast_employees' )->publish;
    $data['slogan']             = 'SEO for Everyone';
    $data['description']        = 'Yoast helps you with your website optimization, whether it be through our widely used SEO software or our online SEO courses: we're here to help.';
    $data['url']                = 'https://yoast.com/';
    $data['legalName']          = 'Yoast BV';
    $data['alternateName']      = 'Yoast';
    $data['parentOrganization'] = [
        '@type'       => 'Organization',
        'name'        => 'Newfold Digital',
        'description' => 'Newfold Digital is a leading web presence solutions provider serving millions of small-to-medium businesses globally.',
        'url'         => 'https://newfold.com/',
        'sameAs'      => [
            'https://newfold.com/',
        ],
        'logo'        => 'https://yoast.com/app/uploads/2022/01/newfold-logo.png',
    ];
    $data['memberOf']           = [
        '@type'       => 'Organization',
        'name'        => 'World Wide Web Consortium (W3C)',
        'description' => 'The World Wide Web Consortium (W3C) is an international community that develops open standards to ensure the long-term growth of the Web.',
        'url'         => 'https://w3.org/',
        'sameAs'      => [
            'https://w3.org/',
        ],
        'logo'        => 'https://www.w3.org/Icons/w3c_main.png',
    ];

    return $data;
}

要对我们的架构输出进行更多修改,请参阅 Yoast SEO 架构 API