feat(courses): Add Landing Page content modules
This commit is contained in:
committed by
Benedikt Rötsch
parent
e2ceb39e83
commit
0c66b6678c
@@ -7,12 +7,19 @@ exports.initClient = (config = {space: process.env.CF_SPACE, accessToken: proces
|
||||
client = createClient(config)
|
||||
previewClient = createClient({...config, host: 'preview.contentful.com'})
|
||||
}
|
||||
|
||||
exports.getCourses = () => {
|
||||
// to get all the courses we simply request from Contentful all the entries
|
||||
// with the content_type `course`
|
||||
return client.getEntries({content_type: 'course'})
|
||||
}
|
||||
|
||||
exports.getLandingPage = () => {
|
||||
// our Home page is fully configureable via contentful
|
||||
return client.getEntries({content_type: 'landingPage', 'fields.slug': 'contentful-university'})
|
||||
.then((response) => response.items[0])
|
||||
}
|
||||
|
||||
exports.getCourse = (slug) => {
|
||||
// the SDK support link resolution only when you request the collection endpoint
|
||||
// That's why we are using getEntries with a query instead of getEntry(entryId)
|
||||
|
||||
Reference in New Issue
Block a user