{"id":15101389,"url":"https://github.com/contentful/contentful-metalsmith","last_synced_at":"2025-10-08T08:32:18.933Z","repository":{"id":18620439,"uuid":"21826146","full_name":"contentful/contentful-metalsmith","owner":"contentful","description":"A plugin for Metalsmith that pulls content from the Contentful API","archived":true,"fork":false,"pushed_at":"2021-11-26T10:00:41.000Z","size":46,"stargazers_count":87,"open_issues_count":14,"forks_count":32,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-01-15T09:51:36.546Z","etag":null,"topics":["contentful","metalsmith"],"latest_commit_sha":null,"homepage":null,"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/contentful.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2014-07-14T16:10:59.000Z","updated_at":"2024-09-13T09:28:15.000Z","dependencies_parsed_at":"2022-09-11T17:00:32.090Z","dependency_job_id":null,"html_url":"https://github.com/contentful/contentful-metalsmith","commit_stats":null,"previous_names":["contentful-labs/contentful-metalsmith"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-metalsmith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-metalsmith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-metalsmith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful-metalsmith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentful","download_url":"https://codeload.github.com/contentful/contentful-metalsmith/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235665636,"owners_count":19026235,"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","metalsmith"],"created_at":"2024-09-25T18:21:40.924Z","updated_at":"2025-10-08T08:32:18.592Z","avatar_url":"https://github.com/contentful.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# contentful-metalsmith\n[![Build Status](https://travis-ci.org/contentful/contentful-metalsmith.svg?branch=master)](https://travis-ci.org/contentful/contentful-metalsmith)\n[![Coverage Status](https://coveralls.io/repos/github/contentful-labs/contentful-metalsmith/badge.svg?branch=refactor)](https://coveralls.io/github/contentful-labs/contentful-metalsmith?branch=refactor)\n\n\u003e **Note**: This tool is no longer officially supported as of Nov 26th, 2021.\n\u003e You can feel free to use it, fork it and patch it for your own needs.\n\nA Metalsmith' plugin to generate files using content from [Contentful](http://www.contentful.com)\n\n## About\n\nThis plugin for [metalsmith](http://www.metalsmith.io) allows you to build a static site using the data stored at [Contentful](http://www.contentful.com). It is built on top of the [Contentful JavaScript Client](https://github.com/contentful/contentful.js).\n\n## Example\n\nTo get an idea on how this works, you can check out an [example blog site](https://github.com/contentful-labs/contentful-metalsmith-example) which is completely generated using contentful-metalsmith.\n\n## Getting started\n\n### Install\n\n```bash\n$ npm install contentful-metalsmith\n```\n\n### Configure required globals\n\nWhen you use metalsmith using the [cli](https://github.com/metalsmith/metalsmith#cli) edit your `metalsmith.json` and add `contentful-metalsmith` in the plugins section.\n\n```javascript\n// metalsmith.json\n\n{\n  \"source\": \"src\",\n  \"destination\": \"build\",\n  \"plugins\": {\n    \"contentful-metalsmith\": {\n      \"access_token\": \"YOUR_CONTENTFUL_ACCESS_TOKEN\",\n      \"space_id\": \"YOUR_CONTENTFUL_SPACE_ID\"\n    }\n  }\n}\n```\n\nWhen you use the [JavaScript Api](https://github.com/metalsmith/metalsmith#api) add `contentful-metalsmith` to the used plugins.\n\n```javascript\nmetalsmith.source('src')\nmetalsmith.destination('build')\n\nmetalsmith.use(require('contentful-metalsmith')({ 'access_token' : 'YOUR_CONTENTFUL_ACCESS_TOKEN' }))\n```\n\n**Global parameters:**\n\n- `access_token`\n- `space_id`\n\nYou can find the `access_token` and `space_id` in your [app](https://app.contentful.com) at `APIs -\u003e Content delivery API Keys`.\n\n------------------------------\n\nTo read more on all global parameters and settings read the [global settings documentation](./docs/global-settings.md).\n\n### Create files based on the files defined in your source folder\n\nWe're considering that you use [metalsmith-layouts](https://github.com/superwolff/metalsmith-layouts) for file rendering. That for the `layout` key is used for rendered source files and child templates.\n\n*`source/posts.html`*\n\n```markdown\n---\ntitle: metalsmith-contentful file\ncontentful:\n  content_type: post\n  entry_filename_pattern: blog/post-${ sys.id }\n  entry_template: post.html\nlayout: posts.html\n---\n\n[OPTIONAL CONTENT]\n```\n\n*`layouts/posts.html`*\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003ctitle\u003e{{title}}\u003c/title\u003e\n  \u003cmeta name=\"description\" content=\"No description\"\u003e\n  \u003cmeta name=\"author\" content=\"Contentful\"\u003e\n  \u003clink rel=\"stylesheet\" href=\"scss/style.css?v=1.0\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003cul\u003e\n    \u003c!-- available data fetched from contentful --\u003e\n    {{#each data.entries }}\n      \u003cli\u003e\n        \u003ch2\u003e{{fields.title}}\u003c/h2\u003e\n        \u003cp\u003e{{fields.description}}\u003c/p\u003e\n        \u003cp\u003e\u003ca href=\"{{_fileName}}\"\u003eRead more\u003c/a\u003e\u003c/p\u003e\n      \u003c/li\u003e\n    {{/each}}\n    \u003c/ul\u003e\n    {{contents}}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n*`layouts/post.html`*\n\n```html\n\u003c!doctype html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n  \u003cmeta charset=\"utf-8\"\u003e\n  \u003ctitle\u003e{{data.fields.title}}\u003c/title\u003e\n  \u003cmeta name=\"description\" content=\"No description\"\u003e\n  \u003cmeta name=\"author\" content=\"Contentful\"\u003e\n  \u003clink rel=\"stylesheet\" href=\"scss/style.css?v=1.0\"\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n  \u003ch1\u003e{{data.fields.title}}\u003ch1\u003e\n  \u003cp\u003e{{data.fields.description}}\u003c/p\u003e\n\n  {{contents}}\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n**This example will**\n\n- render `posts.html` providing data of the entries of content type `post`\n- render several single files with the template `post.html` providing the data of a particular post\n\n------------------------------\n\nTo read more on source file parameters and settings read the [source file documentation](./docs/source-file-settings.md).\n\n## Debugging\n\nThis project uses [debug](https://www.npmjs.com/package/debug) under the hood. If you want to see all debug messages by contentful-metalsmith you can do so by setting a wildcard debug environment variable.\n\n```bash\n$ DEBUG=metalsmith-contentful* your command\n```\n\nCurrently there are two different variables available to give you information about a specific area:\n\n- `metalsmith-contentful-files` - get information about file data before/after processing\n- `metalsmith-contentful-queries` - get information about queries and related files\n\nFor example if you want to see what files went into the plugin and got out again:\n\n```bash\n$ DEBUG=metalsmith-contentful-files your command\n```\n\n:point_up: *This debug information is good to validate what data is available in [metalsmith-layouts](https://www.npmjs.com/package/metalsmith-layouts).*\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful-metalsmith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentful%2Fcontentful-metalsmith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful-metalsmith/lists"}