Hi,
I’ve added Contentful’s Javascript Delivery SDK to VuePress - a static site generator (details below). I thought Contentful’s Content Delivery API is used once to build the site with the content I received. But in the network section of the browser developer tools I see API requests even after the site has been deployed to Netlify/ is live.
Is that the way it should be?
How I added Contentful to VuePress:
-
I created docs/.vuepress/contentful.js
const contentful = require('contentful') const config = { space: "example-space", accessToken: "example-token" } module.exports = { createClient () { return contentful.createClient(config) } }
-
I added to the in docs/.vuepress/components/ExampleComponent.vue
import { createClient } from '../contentful.js' const client = createClient() ... created() { client .getEntry("example-entry") .then(entry => this.data = entry) .catch(err => console.log(err)); } }
Thank you very much for your help