• Resolved jedney

    (@jedney)


    Thanks for all your efforts with EME, it’s a great plugin and has helped me get a small community group off the ground.

    I would like to improve my site by getting the EME events to show properly in Google search results. The best way to do this seems to be to embed a JSON LD object into each event page with the event details. I’ve tried doing this by adding the following SCRIPT block under the HTML in the “Default single event format” field in the Event, Settings page:

    {I’ve removed the leading < on the SCRIPT tag so it isn’t stripped/processed by the forum!}

    SCRIPT type=”application/ld+json”>
    {
    “@context”: “http://schema.org&#8221;,
    “@type”: “Event”,
    “location”: {
    “@type”: “Place”,
    “address”: {
    “@type”: “PostalAddress”,
    “addressLocality”: “#_TOWN”,
    “addressRegion”: “#_STATE”,
    “postalCode”: “#_ZIP”,
    “streetAddress”: “#_ADDRESS”
    },
    “name”: “#_LOCATIONNAME”
    },
    “name”: “#_EVENTNAME”,
    “offers”: {
    “@type”: “Offer”,
    “price”: “#_PRICE”,
    “priceCurrency”: “#_CURRENCY”,
    “url”: “#_EXTERNALURL”
    },
    “startDate”: “#_{Y-m-d}T#_24HSTARTTIME”,
    “endDate”: “#@_{Y-m-d}T#_24HENDTIME”,
    “description”: “#_EVENTDETAILS”,
    “isAccessibleForFree”: true,
    “maximumAttendeeCapacity”: “#_TOTALSPACES”,
    “remainingAttendeeCapacity”: “#_AVAILABLESPACES”,
    “url”: “#_EXTERNALURL”
    }
    /SCRIPT>

    Unfortunately the SCRIPT block is stripped out when the settings are saved.

    Is there a better way to do this?
    Could this maybe be considered for a new feature in a future version?

    Thanks for your help!

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Franky

    (@liedekef)

    Google understands the simple commonly used meta-tags (like description), and those can/should be added to the EME option “Extra event html headers” (in the “Others” section of the EME settings). Search the internet for “google metatags” for more info.

    Thread Starter jedney

    (@jedney)

    Thanks Franky.

    For anyone else trying to do this, here’s some sample code which you can include in your site (I ended up putting it under the “Default single event format” HTML in the “Events” tab of Settings):

    <div itemscope itemtype="http://schema.org/Event" style="display:none">
      <meta itemprop="description" content="#_NOTES">
      <meta itemprop="remainingAttendeeCapacity" content="#_TOTALSPACES">
      <meta itemprop="remainingAttendeeCapacity" content="#_AVAILABLESPACES">
      <meta itemprop="startDate" content="#_{Y-m-d}T#_24HSTARTTIME">
      <meta itemprop="endDate" content="#@_{Y-m-d}T#_24HENDTIME">
      <img itemprop="image" src="#_EVENTIMAGEURL" alt=""/>
      <link itemprop="url" href="#_EXTERNALURL" rel="author"/>
      <a itemprop="url" href="#_EXTERNALURL">
      <span itemprop="name">#_EVENTNAME</span></a>
      <div itemprop="location" itemscope itemtype="http://schema.org/Place">
        <span itemprop="name" style="display:block;">#_LOCATIONNAME</span>
        <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress">
          <span itemprop="streetAddress" style="display:block;">#_ADDRESS</span>
        <div>
        <span itemprop="addressLocality" style="display:block;">#_TOWN</span>,
        <span itemprop="addressRegion"style="display:block;">#_STATE</span>
      </div>
      <span itemprop="postalCode"style="display:block;">#_ZIP</span>
      <span itemprop="addressCountry"style="display:block;">#_COUNTRY</span>
    </div>
    Plugin Author Franky

    (@liedekef)

    Nice. But you used remainingAttendeeCapacity 2 times …

    Thread Starter jedney

    (@jedney)

    Good spotting! Thanks.

    The total spaces should have been “maximumAttendeeCapacity”.

    Thanks again.

    Ambyomoron

    (@josiah-s-carberry)

    Thank you very much for this, @jedney. I am sure each person may have somewhat different needs here.
    I, for one, am thinking of putting this code in the event template, as this gives me greater flexibility, according to the type of event.
    Also, I use #_EXCERPT instead of #_NOTES and #_EVENTPAGEURL instead of #_EXTERNALURL

    What I don’t know, and perhaps someone here can help, is whether there is an advantage to placing these tags in the header section rather than the body section.

    Plugin Author Franky

    (@liedekef)

    Well, I think meta-tags should be in the header section (I’m not sure google indexes these in the page itself).
    See also https://moz.com/blog/meta-data-templates-123
    You can ask google to test your page: https://search.google.com/structured-data/testing-tool

    Thread Starter jedney

    (@jedney)

    Thanks Josiah, I might try some of those tags instead.

    As it stands, my page passes the Google Structured Data Test fine.

    I’m quite unsure on whether these should be in the HEAD or BODY. I agree Meta tags are usually in the HEAD. The code I used came from a generator I found online (and then supplemented with some examples from the Google docs). It spat the code out as a single block but didn’t specify where to put it. As the Meta blocks are wrapped in DIV’s and SPAN’s I took it that the tags are designed to add extra markup to visible content (e.g. BODY content). I got the impression the JSON-LD method is more for when you want the tags hidden in the page (e.g. in the HEAD section).

    I didn’t want all the hassle of having to wrap and tag all the page as I had just got it the way I wanted, so I cheated and used inline CSS on the parent DIV (display:none) to hide all the Metadata 🙂

    Ambyomoron

    (@josiah-s-carberry)

    I’ve looked into this a little more and have found that the microdata are generally at the start of the element of the page that they describe. So, the microdata for an event are found at the start of that event, namely, within the body.

    I have the impression, though, and am not quite sure, that Google doesn’t really care where in the page they occur.

    The meta tags are indeed in the head, though.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Google Event Markup (JSON)’ is closed to new replies.