# metalsmith-fetch

> A Metalsmith plugin to fetch a URL property and add it to the file's context

Latest version **0.0.1** (published 2015-10-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install metalsmith-fetch
pnpm add metalsmith-fetch
yarn add metalsmith-fetch
bun add metalsmith-fetch
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2015-10-02 |
| First published | 2015-10-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Manheim |
| Maintainers | manheim |
| Keywords | metalsmith |

## Links

- npm: https://www.npmjs.com/package/metalsmith-fetch
- Repository: https://github.com/manheim/metalsmith-fetch
- Issues: https://github.com/manheim/metalsmith-fetch/issues
- npm.io page: https://npm.io/package/metalsmith-fetch

## Dependencies (2)

- [debug](https://npm.io/package/debug.md) ^2.1.3
- [request](https://npm.io/package/request.md) ^2.61.0

## Recent versions

- 0.0.1 (latest) — 2015-10-02

## README

# metalsmith-fetch

[![Build Status](https://travis-ci.org/manheim/metalsmith-fetch.svg?branch=master)](https://travis-ci.org/manheim/metalsmith-fetch)

A [Metalsmith](https://github.com/segmentio/metalsmith) plugin to fetch a URL property and add it to the file's context.

## Features

Executes an HTTP GET against the configured property for each file and stores the results as the value of that property.
If the results are JSON, it is parsed before it is stored, otherwise it's stored as a string value.

## Installation

    $ npm install metalsmith-fetch

## Usage

For this Metalsmith pipeline:

```js
var fetch = require('metalsmith-fetch');

Metalsmith(__dirname)
    .use(fetch('swagger'))
    .use(markdown())
    .use(templates('handlebars'))
    .build(function(err) {
        if (err) throw err;
    });
```

and a file with this YAML front matter:

```
---
layout: layout.html
title: A page
swagger: http://petstore.swagger.io/v2/swagger.json
---
Page content
```

The template will have access to a "swagger" variable with the full JSON returned by the URL.

Both fully qualified URLs, as well as local, relative `file:` URLs are supported.

See the tests for more examples.

---
_Source: https://npm.io/package/metalsmith-fetch · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
