Skip to content

Instantly share code, notes, and snippets.

@ivanoats
Created July 20, 2016 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanoats/913bdb3f71df5177c20358e474fe4c13 to your computer and use it in GitHub Desktop.
Save ivanoats/913bdb3f71df5177c20358e474fe4c13 to your computer and use it in GitHub Desktop.
createBlogPost.js
const result = await space.createEntry('legacyPost', {
sys: {
createdAt: post.created_at,
updatedAt: post.updated_at,
},
fields: {
title: { 'en-US': post.title },
body: { 'en-US': post.body },
slug: { 'en-US': post.slug },
authorName: { 'en-US': post.author_name },
intro: { 'en-US': post.intro },
description: { 'en-US': post.description },
scheduledPubTime: { 'en-US': post.scheduled_time },
imageCredit: { 'en-US': post.image_credit },
legacyFeaturedImageUrl: {
'en-US': `${assetHost}/blogs/${post.id}/featured_images/${post.featured_image_file_name}`,
},
promotion: {
'en-US': {
sys: {
type: 'Link',
linkType: 'Entry',
id: promoId,
},
},
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment