如何使用跨站点结构化数据和Schema.org连接主页和博客? [英] How to connect homepage and blog using cross-site structured data with Schema.org?

查看:311
本文介绍了如何使用跨站点结构化数据和Schema.org连接主页和博客?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,一个博客和一些社交媒体资料.我想解释这些在线存在与使用Schema.org的搜索引擎之间的关系.

I have a website, a blog, and several social media profiles. I want to explain the relation between these online presences to search engines using Schema.org.

从文档和Google上的示例中,我知道以下代码将网站和社交媒体资料与我的名字相关联:

From the documentation and from examples on Google, I know that the following code connects the website and the social media profiles to my name:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "name": "your name",
  "url": "http://www.your-site.com",             //  <= homepage
  "sameAs": [
    "http://www.facebook.com/your-profile",
    "http://instagram.com/yourProfile",
    "http://www.linkedin.com/in/yourprofile",
    "http://plus.google.com/your_profile"
  ]
}
</script>

但是声明博客的正确方法是什么?

Schema.org上存在与博客相关的类型和属性,但是这些类型和属性用于标记与博客本身相关的博客内容.我要标记的是博客与个人网站主页上其他在线状态的关系.我该怎么办?

There are types and properties on Schema.org relating to blogs, but these are used for marking up the contents of the blog in relation to the blog itself. What I want is to mark up the relation of the blog to the other online presences on the home page of my personal website. How do I do that?

在我看来,我不能使用url,因为这是商品的网址",即我的个人主页;而我不能使用sameAs,因为那是引用网页的URL明确表示该项目的身份.例如,该项目的Wikipedia页面,Freebase页面或官方网站的URL."根据 Google ,社交媒体链接必须断开在这里.

It seems to me that I cannot use url, as that is the "URL of the item", i.e. my personal home page; and I cannot use sameAs, as that is the "URL of a reference Web page that unambiguously indicates the item's identity. E.g. the URL of the item's Wikipedia page, Freebase page, or official website." According to Google, the social media links have to go here.

另一方面,sameAs的定义在schema.org上继续,包括"[例如]该项目的Wikipedia页面,Freebase页面或官方网站的URL".后者向我表明我可以(或应该)将整个架构放在我的博客上,博客地址为url,主页地址为sameAs,如下所示:

On the other hand, the definition of sameAs continues on schema.org to include "[e].g. the URL of the item's Wikipedia page, Freebase page, or official website". The latter indicates to me that I could (or should) put the whole schema on my blog, have the blog address as url and my home page address as sameAs, like this:

<script type="application/ld+json">
{
  "@context": "http://schema.org",
  "@type": "Person",
  "name": "your name",
  "url": "http://my.blog.com",                   //  <= blog
  "sameAs": [
    "http://www.facebook.com/your-profile",
    "http://instagram.com/yourProfile",
    "http://www.linkedin.com/in/yourprofile",
    "http://plus.google.com/your_profile",
    "http://www.my-website.com",                 //  <= homepage
  ]
}
</script>

但是我找不到任何示例,或者其他方法.

But I cannot find any example for this, or how else do to it.

推荐答案

我认为没有理由以与您处理方式不同的方式来处理博客(如果未集成到您的主站点中,那么它也是一种网站)主要网站,假设这两个网站都是个人网站(即以某种方式代表您),则无论您使用的是 contactPointsameAsurl .

I think there is no reason to handle the blog (which, if not integrated in your primary site, is also a kind of website) differently from how you handle the primary website, assuming that both are personal sites (i.e., representing you in some way), whether you use contactPoint, sameAs, or url.

还有另一种方法,这种方法使您可以提供有关URL的数据(例如,使关系清楚):

There is also another way, and this one allows you to provide data about the URLs (e.g., to make the relationship clear):

WebSite (以及

  • accountablePerson
  • author / creator
  • copyrightHolder
  • 如果您不想为WebSite/Blog提供顶级对象,则可以使用JSON-LD的

    If you don’t want to provide top-level objects for WebSite/Blog, you could use JSON-LD’s @reverse keyword:

    {
      "@context": "http://schema.org",
      "@type": "Person",
      "name": "John Doe",
      "@reverse": {
        "author": 
        [
          {
            "@type": "WebSite",
            "url": "https://example.com/"
          },
          {
            "@type": ["Blog", "WebSite"],
            "url": "https://blog.example.com/"
          }
        ]         
      }
    }
    

    但是使用多个顶级对象(例如,@graph 一起使用),

    But using multiple top-level objects (e.g., with @graph), each with its @id, is more flexible.

    这篇关于如何使用跨站点结构化数据和Schema.org连接主页和博客?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆