{"id":13506713,"url":"https://github.com/scaccogatto/contentful-module","last_synced_at":"2025-10-08T08:32:27.194Z","repository":{"id":47941203,"uuid":"221225905","full_name":"scaccogatto/contentful-module","owner":"scaccogatto","description":"multiple environment Contentful client binding for NuxtJS","archived":true,"fork":false,"pushed_at":"2021-08-11T16:35:38.000Z","size":432,"stargazers_count":20,"open_issues_count":7,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-08T09:01:03.525Z","etag":null,"topics":["contentful","nuxtjs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scaccogatto.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-12T13:35:33.000Z","updated_at":"2023-01-28T04:20:22.000Z","dependencies_parsed_at":"2022-08-12T14:41:27.295Z","dependency_job_id":null,"html_url":"https://github.com/scaccogatto/contentful-module","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaccogatto%2Fcontentful-module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaccogatto%2Fcontentful-module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaccogatto%2Fcontentful-module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scaccogatto%2Fcontentful-module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scaccogatto","download_url":"https://codeload.github.com/scaccogatto/contentful-module/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235700110,"owners_count":19031668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contentful","nuxtjs"],"created_at":"2024-08-01T01:00:56.088Z","updated_at":"2025-10-08T08:32:21.895Z","avatar_url":"https://github.com/scaccogatto.png","language":"JavaScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# NuxtJS Contentful Module\n\n\u003e multiple environment Contentful client binding for NuxtJS\n\n## Features\n\n- [x] Makes `this.$contentful` and `app.$contentful` globally available so you can easily fetch Contentful data everywhere\n- [x] Supports multiple environments, so you can switch easily\n- [x] Available in SSR context (`asyncData`)\n\n## Install\n\n### Install the module\n`npm i contentful-module`\n\n### Find your API keys\n\n1. Open your Contentful panel\n2. Settings\n3. API keys\n4. Add API key (top right button)\n5. Use Space ID and Content Delivery API - access token in your `nuxt.config.js`\n\n### Edit `nuxt.config.js`\n\n```js\n// nuxt.config.js\nexport default {\n  build: {\n    transpile: ['contentful-module']\n  },\n  modules: [\n    'contentful-module'\n  ],\n  contentful: {\n    default: 'master',\n    activeEnvironments: ['master'],\n    environments: {\n      master: {\n        space: 'YOUR_SPACE_ID',\n        accessToken: 'CONTENT_DELIVERY_API_ACCESS_TOKEN',\n        environment: 'master'\n      }\n    }\n  }\n}\n```\n\n## Usage\n\n### Contentful docs\n\nYou can use `$contentful.client` as explained on [Content Delivery API Docs](https://www.contentful.com/developers/docs/references/content-delivery-api/)\n\n### Components (`.vue` files)\n\n```js\nexport default {\n  methods: {\n    myMethod() {\n      // same as: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/content-type/query-entries/console/js\n      this.$contentful.client.getEntries({\n        content_type: '\u003ccontent_type_id\u003e'\n      )}\n    }\n  }\n}\n```\n\n### Context\n\n```js\nexport default {\n  asyncData({ app }) {\n    // same as: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/content-type/query-entries/console/js\n    app.$contentful.client.getEntries({\n      content_type: '\u003ccontent_type_id\u003e'\n    )}\n  }\n}\n```\n\n### Single Environment\n\n```js\n// nuxt.config.js\nexport default {\n  build: {\n    transpile: ['contentful-module']\n  },\n  modules: [\n    'contentful-module'\n  ],\n  contentful: {\n    default: 'master', // this will be available by calling this.$contentful.client\n    activeEnvironments: ['master'], // useful when you need to activate an environment by using process.env vars\n    environments: {\n      master: {\n        space: 'YOUR_SPACE_ID',\n        accessToken: 'CONTENT_DELIVERY_API_ACCESS_TOKEN',\n        environment: 'master'\n      }\n    }\n  }\n}\n```\n\nNow you will be able to:\n\n- [x] Call `master` environment by using `this.$contentful.client`\n\n### Multiple Environments\n\n```js\n// nuxt.config.js\nexport default {\n  build: {\n    transpile: ['contentful-module']\n  },\n  modules: [\n    'contentful-module'\n  ],\n  contentful: {\n    default: 'master', // this will be available by calling this.$contentful.client\n    activeEnvironments: ['master', 'staging'], // useful when you need to activate an environment by using process.env vars\n    environments: {\n      master: {\n        space: 'YOUR_SPACE_ID',\n        accessToken: 'CONTENT_DELIVERY_API_ACCESS_TOKEN',\n        environment: 'master'\n      },\n      staging: {\n        space: 'YOUR_SPACE_ID',\n        accessToken: 'CONTENT_DELIVERY_API_ACCESS_TOKEN',\n        environment: 'staging'\n      }\n    }\n  }\n}\n```\n\nNow you will be able to:\n\n- [x] Call `master` environment by using `this.$contentful.client` or `this.$contentful.master`\n- [x] Call `staging` environment by using `this.$contentful.staging`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaccogatto%2Fcontentful-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscaccogatto%2Fcontentful-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscaccogatto%2Fcontentful-module/lists"}