Skip to content

Instantly share code, notes, and snippets.

@iamnbutler
Created April 17, 2021 10:49
Show Gist options
  • Save iamnbutler/9f00de97d1e5508b1f12a19d597080b3 to your computer and use it in GitHub Desktop.
Save iamnbutler/9f00de97d1e5508b1f12a19d597080b3 to your computer and use it in GitHub Desktop.
// I spent forever trying to figure this out so I thought
// I'd just post this here in case someone else stumbles across it.
// If 'record' is your record object ("records.forEach(function (record)")
// You can access a field by using record.fields.YOUR_FIELD_NAME
// This example is me creating YAML frontmatter using fields from my Base.
const p = record.fields;
let frontMatter = {
'post_visible': p.post_visible,
status: p.status,
title: title,
subtitle: p.subtitle,
slug: slug,
'custom_slug': p.custom_slug,
date: date,
'date_updated': p.date_updated,
author: p.author,
'primary_tag': p.primary_tag,
tags: p.tags,
summary: p.summary,
edit: p.edit,
featured: p.featured,
'show_thumbnail': p.show_thumbnail,
thumbnail: p.thumbnail,
'prefer_wide_thumbnail': p.prefer_wide_thumbnail,
wide_thumbnail: p.wide_thumbnail,
hero_image: p.hero_image,
post_images: p.post_images,
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment