{"id":14985676,"url":"https://github.com/fephil/metalsmith-metadata-directory","last_synced_at":"2025-04-11T22:06:33.474Z","repository":{"id":7001571,"uuid":"55905666","full_name":"fephil/metalsmith-metadata-directory","owner":"fephil","description":"📔 A Metalsmith plugin to add a directory of JSON files for use as global metadata in templates, partials and pages.","archived":false,"fork":false,"pushed_at":"2022-12-30T18:45:11.000Z","size":174,"stargazers_count":13,"open_issues_count":8,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-25T17:53:35.500Z","etag":null,"topics":["glob","json","metadata","metalsmith","metalsmith-plugin","partials","templates","yaml","yml"],"latest_commit_sha":null,"homepage":"https://github.com/fephil/metalsmith-metadata-directory","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fephil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-04-10T15:05:31.000Z","updated_at":"2024-08-20T18:44:12.000Z","dependencies_parsed_at":"2023-01-13T14:13:08.729Z","dependency_job_id":null,"html_url":"https://github.com/fephil/metalsmith-metadata-directory","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fephil%2Fmetalsmith-metadata-directory","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fephil%2Fmetalsmith-metadata-directory/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fephil%2Fmetalsmith-metadata-directory/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fephil%2Fmetalsmith-metadata-directory/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fephil","download_url":"https://codeload.github.com/fephil/metalsmith-metadata-directory/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248196854,"owners_count":21063516,"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":["glob","json","metadata","metalsmith","metalsmith-plugin","partials","templates","yaml","yml"],"created_at":"2024-09-24T14:11:28.257Z","updated_at":"2025-04-11T22:06:33.435Z","avatar_url":"https://github.com/fephil.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# metalsmith-metadata-directory\n\n[![npm](https://img.shields.io/npm/v/metalsmith-metadata-directory.svg)](https://www.npmjs.com/package/metalsmith-metadata-directory)\n[![Build Status](https://travis-ci.org/fephil/metalsmith-metadata-directory.svg?branch=master)](https://travis-ci.org/fephil/metalsmith-metadata-directory)\n[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/fephil/metalsmith-metadata-directory/master/LICENSE)\n\n\u003e A Metalsmith plugin to add a directory of JSON and/or YAML files for use as global metadata in templates, partials and pages.\n\n* Author: [Phil Lennon](https://phil.dev)\n* Source: [github.com/fephil/metalsmith-metadata-directory](https://github.com/fephil/metalsmith-metadata-directory)\n* Issues \u0026 Suggestions: [github.com/fephil/metalsmith-metadata-directory/issues](https://github.com/fephil/metalsmith-metadata-directory/issues)\n* Releases: [https://github.com/fephil/metalsmith-metadata-directory/releases](https://github.com/fephil/metalsmith-metadata-directory/releases)\n* Twitter: [@frontendphil](https://twitter.com/frontendphil)\n* Email: [enquiry@phil.dev](mailto:enquiry@phil.dev)\n\n***\n\n## About\n\nThis plugin supports adding a directory of `.json` \u0026 `.yml/.yaml` files and makes their contents available to the Metalsmith global metadata, without needing to declare multiple file names. Subdirectories and multiple files are supported by using a globbing pattern.\n\n## Node support\n\nThis plugin is supported and tested against all the current Node LTS versions (10 \u0026 12). This plugin should work on Node 6 \u0026 8 but is not supported for these versions.\n\n## Installation\n\nInstall the plugin using npm, and specify the directory of metadata files you want to use, along with a globbing pattern.\n\n```\n$ npm install metalsmith-metadata-directory --save-dev\n```\n\n### With Metalsmith CLI\n\nAdd the plugin to your metalsmith.json file:\n\n```js\n{\n  \"plugins\": {\n    \"metalsmith-metadata-directory\": {\n      \"directory\": \"/src/data/**/*.json\"\n    }\n  }\n}\n```\n\n**NOTE:** .yml and .yaml file extensions are also supported.\n\n### With JavaScript\n\nPass the plugin into metalsmith.use:\n\n```js\nvar metalsmith = require('metalsmith')\nvar metadata = require('metalsmith-metadata-directory')\n\nmetalsmith.use(metadata({\n  directory: '/src/data/**/*.json',\n  // or for YAML respectively; be sure to use 'yml' or 'yaml' as file suffix\n  directory: '/src/data/**/*.yml'\n}));\n```\n\n## Plugin ordering\n\nIt is vital to order Metalsmith plugins correctly. Please make sure this plugin is included above metalsmith-layouts and metalsmith-in-place and any other plugin which may use your metadata.\n\n## Usage within Metalsmith\n\nData is called by referencing the filename without an extension. For example, if there was a global.json file containing a url key, the reference in your page or template would look like:\n\n```js\n{{global.url}}\n```\n\n## Debug mode\n\nThis plugin supports debugging output. To enable, use the following command when running Metalsmith:\n\n```\n$ DEBUG=metalsmith-metadata-directory metalsmith\n```\n\n## Licence\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffephil%2Fmetalsmith-metadata-directory","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffephil%2Fmetalsmith-metadata-directory","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffephil%2Fmetalsmith-metadata-directory/lists"}