Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Contentful Javascript API - looking up an entry by slug

Tags:

contentful

I see how to query an Entry by the ID.

Is there a way to lookup by slug? That is what I really want to do.

Thanks!

like image 517
metahamza Avatar asked Oct 25 '16 23:10

metahamza


Video Answer


1 Answers

If you're using the SDK, you might as well do

this.contentfulClient.getEntries({
  content_type: 'YOUR_CONTENT_KEY',
  'fields.slug[in]': 'THE_SLUG_YOU_ARE_LOOKING_FOR',
})
like image 96
maxime1992 Avatar answered Oct 13 '22 13:10

maxime1992