Created
April 18, 2017 08:38
-
-
Save prisme/358f1c78e908f0dabd700a5f2803693a to your computer and use it in GitHub Desktop.
hybrid slices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.route('/').get(function(req, res){ | |
api(req, res) | |
.then(function(api) { | |
api.query( prismic.Predicates.at('document.type', 'home-page') ) | |
.then((pageContent) => { | |
if (pageContent) { | |
res.render('index', { | |
pageContent : pageContent.results[0], | |
}); | |
} else { | |
res.status(404).send('404 not found'); | |
} | |
}) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Home Page" : { | |
"body" : { | |
"fieldset" : "page content", | |
"type" : "Slices", | |
"config" : { | |
"choices" : { | |
"intro" : { | |
"type" : "Slice", | |
"fieldset" : "Intro", | |
"non-repeat" : { | |
"logo" : { | |
"type" : "Image" | |
}, | |
"text" : { | |
"type" : "StructuredText", | |
"fieldset" : "Text", | |
"config" : { | |
"multi" : "paragraph", | |
"label" : "text", | |
"placeholder" : "intro text" | |
} | |
} | |
}, | |
"repeat" : { | |
"image" : { | |
"type" : "Image", | |
"config" : { | |
"label" : "gallery image" | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div | |
- var sliceZone = pageContent.getSliceZone('home-page.body') || {} | |
for slice in sliceZone.slices | |
case slice.sliceType | |
when 'intro' | |
// - var images = ?? | |
// - var text = ?? | |
// - var text = slice.nonRepeat.text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment