@id vs. URL for linking JSON-LD nodes

@id (JSON-LD)

(and the same goes for itemid in Microdata, and resource in RDFa)

Each thing should get a different URI, and if multiple nodes are about the same thing, they should ideally reuse this URI. Note that these don’t have to be URLs, and they should often not be used as values for Schema.org’s url property (see section below).

Using URI fragments is a common and the most simple way to achieve this. For examples (and other ways), see my answers to these questions:

For your example case, an organization’s website, the root URL (http://www.example.com/) typically “stands for” three things:

  • the home page
  • the whole website
  • the organization

As the home page is the resource that gets retrieved, it should get the URI http://www.example.com/. The site and the organization should get their own fragments; it’s up to you to choose which ones, e.g.: http://www.example.com/#site for the site, and http://www.example.com/#organization for the organization (FWIW, Apple seems to use #organization, too.)

  • the home page:
    http://www.example.com/

  • the whole website:
    http://www.example.com/#site

  • the organization:
    http://www.example.com/#organization

(Often only two different things are involved: the document, and the thing described by the document. Then the thing often gets a fragment like #this, and in case of persons, #i, but this is just a convention.)

If that works, will processors (Google) load the @id to find the rest of the node’s properties?

Google doesn’t document if they try to load those URIs.

Note that there is no requirement that these URIs actually point to a document. You could use HTTP URIs that give 404 answers, or you could use a URI scheme that doesn’t allow retrieval of documents to begin with (e.g., urn, tag, …).

url (Schema.org)

Schema.org’s url property should be used for the URLs that lead to pages that can be visited. It’s not intended as a way to provide an ID, so it’s not necessarily the same URI as provided in @id.

In your example case, you would probably use the same url value for all three things:

  • the home page:
    @id: http://www.example.com/
    url: http://www.example.com/

  • the whole website:
    @id: http://www.example.com/#site
    url: http://www.example.com/

  • the organization:
    @id: http://www.example.com/#organization
    url: http://www.example.com/

Leave a Comment