Created
December 6, 2019 14:56
-
-
Save mornir/621dc909a2d1bebcdabde650857d2e1b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
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