2
votes

Here is my markup with rich snippets

<div vocab="http://schema.org" typeof="GovernmentOrganization">
<p>
    <span property="logo"><img src="http://www.place.com/image.png" class="logo"/></span>
    <span class="h2" property="name">Department Of Stuff And Things</span><br />
    <span class="h4" property="department">State Agency</span><br />
    <a href="http://www.place.com" class="h4 text-primary" property="url">http://www.place.com</a>
</p>

<strong>Locations:</strong><br /><br />                 
    <div property="location" typeof="GovernmentOffice">
        <p property="location" typeof="PostalAddress">
            Main Office<br />
            <span property="streetAddress">555 Something Street Apt 2</span><br />
            <span property="addressLocality">Jacksonville</span> 
            <span property="addressRegion">FL</span> 
            <span property="postalCode">11111</span><br />
            <span property="addressCountry">US</span>
        </p>
    </div>

<strong>Services:</strong><br /><br />
<div property="hasOfferCatalog" typeof="OfferCatalog">
        <div property="itemListElement" typeof="GovernmentService">
            <p>
                <strong><span property="name">Service 1</span></strong><br />
                <span property="category">Web Based</span><br />
                <span property="description">Get Some stuff and things</span><br />
                <a href="https://www.place.com/Service1" property="url">https://www.place.com/Service1</a><br />
            </p>
        </div>
        <div property="itemListElement" typeof="GovernmentService">
            <p>
                <strong><span property="name">Apply For Benefits</span></strong><br />
                <span property="category">Phone Based</span><br />
                <span property="description">This service helps you apply for the benefits you deserve</span><br />
                <a href="https://www.place.com/Service2" property="url">https://www.place.com/Service1</a><br />
            </p>
        </div>
</div> 

The structured data testing tool seems to organize and validate everything appropriately, Including my small collection of services (OfferCatalog). When doing a request to the Custom Search API and tacking on the :more:pagemap:GovernmentOrganization things seem to be OK and I get results I expect. But the JSON object for pagemap only includes the first level of my organization:

"pagemap": {
"GovernmentOrganization": [
 {
  "name": "Department Of Stuff And Things",
  "department": "State Agency",
  "url": "http://www.place.com"
 },

Any ideas on why my related objects (GovernmentOffice / locations / OfferCatalog / GovernmentServices) are not being including? Is there a better way to organize and structure this for Google?

2
Would you show the precise steps and URL that you are using to gen the pagemap? I am using your data with a different processor and getting a JSON-LD doc that is consistent with the RDFa. - Jay Gray
I let google index my page to create the pagemap. I used structured data test tool to verify before the crawl was initiated developers.google.com/structured-data/testing-tool. But ultimately I'm leaving the pagemap up to Google's crawler. Do you think we would have better results by creating and submitting the pagemap ourselves? I do have a test page out there though customsearchweb20160302094014.azurewebsites.net it has one real entry and 3 test entries. I will not be doing multiple agencies on one page for production, I did it simply to test what comes out the other end. - dev null

2 Answers

0
votes

Consider this approach. Include the following JSON-LD script in the document. It can go anywhere but consider placing it before the RDFa DIV:

<script type="application/ld+json" id="">
{
"@context":
    {
      "@vocab": "http://schema.org/",
      "@base": "http://www.place.com/"
    },
"@graph": [
    {
      "@id": "_:ub220bL18C41",
      "@type": "PostalAddress",
      "addressCountry": "US",
      "addressLocality": "Jacksonville",
      "addressRegion": "FL",
      "postalCode": "11111",
      "streetAddress": "555 Something Street Apt 2"
    },
    {
      "@id": "_:ub220bL4C1",
      "@type": "GovernmentOrganization",
      "department": "State Agency",
      "hasOfferCatalog": {
        "@id": "_:ub220bL6C40"
      },
      "location": {
        "@id": "_:ub220bL17C33"
      },
      "logo": "",
      "name": "Department Of Stuff And Things",
      "url": "http://www.place.com"
    },
    {
      "@id": "_:ub220bL17C33",
      "@type": "GovernmentOffice",
      "location": {
        "@id": "_:ub220bL18C41"
      }
    },
    {
      "@id": "_:ub220bL6C40",
      "@type": "OfferCatalog",
      "itemListElement": [
        {
          "@id": "_:ub220bL12C17"
        },
        {
          "@id": "_:ub220bL7C48"
        }
      ]
    },
    {
      "@id": "_:ub220bL12C17",
      "@type": "GovernmentService",
      "category": "Web Based",
      "description": "Get Some stuff and things",
      "name": "Service 1",
      "url": "https://www.place.com/Service1"
    },
    {
      "@id": "_:ub220bL7C48",
      "@type": "GovernmentService",
      "category": "Phone Based",
      "description": "This service helps you apply for the benefits you deserve",
      "name": "Apply For Benefits",
      "url": "https://www.place.com/Service2"
    }
  ]
}
</script>

You'll want to change @base to your site and decide how to organize your directory structure to manage your identifiers. Then change each blank node to the appropriate identifier. Then minimize the JSON-LD.

The JSON-LD is semantically identical to the RDFa. As such, you will be able to analyze the Google pagemap and decide which strategy works better for you. I don't expect Google to penalize the page if the JSON-LD is semantically identical to the HTML/RDFa markup.

0
votes

As per the Google:

I believe you are seeing only one value of a attribute in JSON API.

I would like to update you that as per the design in JSON API we show only one attribute value, while in XML we show all values.

We already have a feature request #16696973 to display all the attribute values in JSON API. Currently I don't have an ETA when it will be implemented.

As a workaround you have to use XML API.