the-events-calendar / ql-events

The Events Calendar binding to WPGraphQL
15 stars 7 forks source link

Tags in linkedData should be stripped before output #17

Open craigwilcox opened 4 years ago

craigwilcox commented 4 years ago

Hi @kidunot89,

We're getting some errors from the structured data tool regarding the output of linked data for ld+json tags.

query MyQuery {
  events {
    nodes {
      linkedData {
        name
        description

      }
    }
  }
}

generates this:

{
  "data": {
    "events": {
      "nodes": [
        {
          "linkedData": {
            "name": "Stitcher’s Garden 2021, Mission Viejo, 12 Sessions, $",
            "description": "<p>Learn fusible applique and how to incorporate your machine\\'s decorative stitches into the appliques to create these pretty, each-one-different blocks!  Each month you will utilize many decorative stitches, learn how to use the different feet available for your machine and new sewing techniques such as machine applique, couching, bobbin work and piping and more!  This [...]</p>\\n<p><a class="btn btn-secondary understrap-read-more-link" href="https://www.moores-sew.com/sewing-class/stitchers-garden-2021-mission-viejo-12-sessions/2020-11-04/">Read More...</a></p>\\n"
          }
        },

When this is run through the Rich Results test (https://search.google.com/test/rich-results?utm_campaign=sdtt&utm_medium=url&id=kCQzL5c3tJzF5HEJDiMOYQ), we get the error "Bad escape sequence in string."

It seems we need to use strip the tags and decode before the linkedData is output. Maybe echo strip_tags(html_entity_decode($yourString));

Would appreciate it if you could handle this.

Thanks, Craig

kidunot89 commented 4 years ago

Hey, not sure why this is happening but the values for the those files are the same as the following


{
  event(...) {
    content(format: RAW)
    title
  }
}