GraphQL query for latest published version

Using the draft/publish option, I’ve been under the assumption that graphql queries would only pull published data for display by default, but I’ve recently noticed that isn’t the case. Draft items are appearing as live pages on my site, and pages that have been updated but are not published are showing the new unpublished data. After a little digging, I found the status filter, which is perfect for getting rid of the drafts, but I’m stuck on how to proceed with the updated data. I can set the status filter to published only, but then the page disappears completely once its status shifts to updated. Is there a filter and/or setting in the admin area that will show only the latest published data?

hello @jdozier-ezell

if you are using the main endpoint you shouldn’t get draft content:

If it’s not the case it is a bug! Can you please help me reproduce?

Just want to follow up to say the issue was on my end. Gatsby wasn’t properly switching previewMode on and off, so the live site was getting the preview as well. Thanks!

1 Like