1

I can get a single Trip marked up correctly using Schema.org:

{
    "@context": "http://schema.org",
    "@type": "Trip",
    "name": "Your ideal trip to England",
    "description": "The dozen best places and areas that should be on you list when visiting England.  Choose you own order but visit as many as you can",
    "itinerary": [
        {
            "@type": "City",
            "name": "Poole",
            "description":  "Sail from Poole to Jersey onboard Condor Liberation in as little as 4 hours 30 minutes",
            "url": "https://en.wikipedia.org/wiki/Poole"
        },
        {
            "@type": "Country",
            "name": "Jersey",
            "description": "Sail to Jersey and fall in love with luscious landsapes and stunning skies",
            "url": "https://en.wikipedia.org/wiki/Jersey"
        },
    ]
}

But when I add another Trip, I get the errors:

    {
    "@context": "http://schema.org",
    "@type": "Trip",
    "name": "Your ideal trip to England",
    "description": "The dozen best places and areas that should be on you list when visiting England.  Choose you own order but visit as many as you can",
    "itinerary": [
        {
            "@type": "City",
            "name": "Poole",
            "description":  "Sail from Poole to Jersey onboard Condor Liberation in as little as 4 hours 30 minutes",
            "url": "https://en.wikipedia.org/wiki/Poole"
        },
        {
            "@type": "Country",
            "name": "Jersey",
            "description": "Sail to Jersey and fall in love with luscious landsapes and stunning skies",
            "url": "https://en.wikipedia.org/wiki/Jersey"
        },
    ]
    },
    {"@type": "Trip",
    "name": "Your ideal trip to England",
    "description": "The dozen best places and areas that should be on you list when visiting England.  Choose you own order but visit as many as you can",
    "itinerary": [
        {
            "@type": "City",
            "name": "Poole",
            "description":  "Sail from Poole to Jersey onboard Condor Liberation in as little as 4 hours 30 minutes",
            "url": "https://en.wikipedia.org/wiki/Poole"
        },
        {
            "@type": "Country",
            "name": "Jersey",
            "description": "Sail to Jersey and fall in love with luscious landsapes and stunning skies",
            "url": "https://en.wikipedia.org/wiki/Jersey"
        }
    ]
}

I basically need to add, Poole to Jersey, Portsmouth to Jersey, St Malo to Jersey as separate Trips, not part of the same itinerary.

1 Answer 1

2

The correct, by Google Structured Data Testing Tool successfully validated code for multiple Trip entities (an array of) would be:

<script type="application/ld+json">
{  
   "@context":"http://schema.org",
   "@graph":[  
      {  
         "@type":"Trip",
         "name":"Your ideal trip to England",
         "description":"The dozen best places and areas that should be on you list when visiting England.  Choose you own order but visit as many as you can",
         "itinerary":[  
            {  
               "@type":"City",
               "name":"Poole",
               "description":"Sail from Poole to Jersey onboard Condor Liberation in as little as 4 hours 30 minutes",
               "url":"https://en.wikipedia.org/wiki/Poole"
            },
            {  
               "@type":"Country",
               "name":"Jersey",
               "description":"Sail to Jersey and fall in love with luscious landsapes and stunning skies",
               "url":"https://en.wikipedia.org/wiki/Jersey"
            }
         ]
      },
      {  
         "@type":"Trip",
         "name":"Your ideal trip to France",
         "description":"The dozen best places and areas that should be on you list when visiting France.  Choose you own order but visit as many as you can",
         "itinerary":[  
            {  
               "@type":"City",
               "name":"Paris",
               "description":"Travel to Paris onboard Condor Liberation in as little as 4 hours 30 minutes",
               "url":"https://en.wikipedia.org/wiki/Paris"
            },
            {  
               "@type":"Country",
               "name":"France",
               "description":"Travel to Paris and fall in love with luscious landsapes and stunning skies",
               "url":"https://en.wikipedia.org/wiki/France"
            }
         ]
      }
   ]
}
</script>

Note, thate itinerary is a pending property, currently not included into the regular draft.

5
  • Ohh ok thank you - what had I done wrong?
    – Becky
    Commented Jan 25, 2019 at 15:50
  • was it this at the end ] } ] }
    – Becky
    Commented Jan 25, 2019 at 15:50
  • @Becky: Note the @graph in line 4. You are correctly using an array for the itinerary values, but with top-level items, this doesn’t work (as there is no property they are added to), so you either have to use @graph with an array value, or use multiple script elements. (Details)
    – unor
    Commented Jan 25, 2019 at 16:28
  • I just improved the indentation so that the ending brackets are less ambiguous. Commented Jan 25, 2019 at 16:30
  • Ohh I see - thank you very much for the explanation this is really helpful!
    – Becky
    Commented Jan 28, 2019 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.