Skip to content

Instantly share code, notes, and snippets.

@onefriendaday
Created January 22, 2018 15:32
Show Gist options
  • Save onefriendaday/228995f4def9731ad722005dfb83dd37 to your computer and use it in GitHub Desktop.
Save onefriendaday/228995f4def9731ad722005dfb83dd37 to your computer and use it in GitHub Desktop.
const StoryblokClient = require('storyblok-js-client')
let Storyblok = new StoryblokClient({
accessToken: 'YOUR_TOKEN'
})
let lastPage = 1
for (var i = 1; i <= lastPage; i++) {
await Storyblok.get('cdn/stories', {
version: 'published',
per_page: 25,
page: i
}).then((res) => {
let stories = res.data.stories
stories.forEach((story) => {
// WRITE TO FILESYSTEM
// story.content
})
let total = res.total
lastPage = Math.ceil((res.total / 25))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment