Data key for portal

where does the data key value for the portal come from? Is it configured somewhere? I need to know what it is to generate the html myself. (these are my environment variables in example)

<script defer src="https://cdn.jsdelivr.net/ghost/portal@~2.43/umd/portal.min.js" data-i18n="false" data-ghost="<%-process.env.GHOST_URL%>/" data-key="<%-process.env.GHOST_PORTAL_DATA_KEY%>" data-api="<%-process.env.GHOST_URL%>/ghost/api/content/" crossorigin="anonymous"></script>

Ghost has an internal integration for Portal, and the content API key for that integration is passed here. If you want to reproduce it, you can create an integration and use its content API key.

1 Like

If you’re running handlebars (so this is part of a theme), you can use the {{content_api_key}} helper. Going to leave that here for anyone else who might have a similar question.

But I think Vikas is right that this is outside of the theme, and so you’ll get that Content API key by going to /ghost > settings (gear icon) > integrations > click the custom tab and click add integration.

2 Likes

thanks Cathy - I marked the other guy’s answer as soution as i am not using handlebars - but useful info.

1 Like