How to connect homepage and blog using cross-site

2019-02-28 00:45发布

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.

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>

But what is the correct way to claim a blog?

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?

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.

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.

1条回答
家丑人穷心不美
2楼-- · 2019-02-28 01:45

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.

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

WebSite (as well as Blog) allows you to reference a Person item with properties like:

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/"
      }
    ]         
  }
}

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

查看更多
登录 后发表回答