Problem with getting RAW format of excerpt in WPGraphQL using Apollo

Viewed 912

When I try to get an excerpt from WPGraphQL plugin and pass excerpt(format: RAW) in the query, it's working fine in the WPGraphiQL window, but when I'm executing the same query in Vue Apollo it's always returning null.

Here is my code:

apollo: {
    posts: gql`
        query {
          posts {
            nodes {
              title
              uri
              date
              databaseId
              featuredImage {
                sourceUrl
              }
              excerpt(format: RAW)
            }
          }
        }
      `
  },

Am I guessing right that it has to deal with enum type on the server-side and the way it's passed in Apollo query string? Also when I pass only excerpt without argument it returns excerpt with HTML tags, so... what's wrong?

2 Answers

Use excerpt(format: FORMATTED)

and use in html like this:

dangerouslySetInnerHTML={{ __html: node.excerpt }}
Related