Skip to content

Instantly share code, notes, and snippets.

@mornir
Created December 6, 2019 14:56
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 mornir/621dc909a2d1bebcdabde650857d2e1b to your computer and use it in GitHub Desktop.
Save mornir/621dc909a2d1bebcdabde650857d2e1b to your computer and use it in GitHub Desktop.
const isDraft = id => id.includes('drafts')
export default function resolveProductionUrl(document) {
if (!isDraft(document._id)) return undefined
const url = 'https://your-website.com'
if (document._type === 'recipe') {
return `${url}/rezepte/preview/?preview_id=${document._id}`
}
if (document._type === 'page') {
return `${url}/preview/?preview_id=${document._id}`
}
return undefined
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment