# metalsmith-handlebars-within

> A metalsmith plugin to specify metadata for `{{#with}}` in Handlebars templates.

Latest version **0.1.0** (published 2015-05-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install metalsmith-handlebars-within
pnpm add metalsmith-handlebars-within
yarn add metalsmith-handlebars-within
bun add metalsmith-handlebars-within
```

## 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.1.0 |
| Published | 2015-05-04 |
| First published | 2015-05-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kenneth Ormandy |
| Maintainers | kennethormandy |
| Keywords | metalsmith, metalsmith plugin, handlebars |

## Links

- npm: https://www.npmjs.com/package/metalsmith-handlebars-within
- Repository: git@github.com:losttype/metalsmith-handlebars-within
- Homepage: http://opensource.losttype.com
- Issues: https://github.com/losttype/metalsmith-handlebars-within/issues
- npm.io page: https://npm.io/package/metalsmith-handlebars-within

## Recent versions

- 0.1.0 (latest) — 2015-05-04

## README

# metalsmith-handlebars-within

A metalsmith plugin to specify dynamic metadata for `{{#with}}` in Handlebars templates.

## Installation

```
npm install metalsmith-handlebars-within
```

## CLI Usage

Install the node module, and then add the `metalsmith-handlebars-within` key to your `metalsmith.json` plugins.

```json
{
  "plugins": {
    "metalsmith-handlebars-within": {}
  }
}
```

There are no options for this plugin. It is intended for use alongside [Handlebars](https://github.com/segmentio/metalsmith-templates) and external [metalsmith-metadata](https://github.com/segmentio/metalsmith-metadata), for example:

```json
{
  "plugins": {
    "metalsmith-metadata": {
      "authors": "./path/to/authors.json"
    },
    "metalsmith-handlebars-within": {},
    "metalsmith-templates": "handlebars"
  }
}
```

Now, within a Handlebars template, you can access a specific object in the `authors.json` metadata, based on a YAML variable:

```hbt
{{#within authors author }}
  <a href="{{ this.url }}">{{this.name}}</a>
{{/within}}
```

## Notes

This all seems excessive to me: it’s something I would expect to be able to access easily in Handlebars:

```hbs
<a href="/about/{{ author }}">{{ authors.[author].name }}</a>
```

…but as far as I can tell, this isn’t possible without a Handlebars helper with `author` is dynamic. If I’m incorrect, please [open an issue](https://github.com/losttype/metalsmith-handlebars-within/issues), and I’ll see if this plugin is actually necessary! Thanks.

## License

[The MIT License (MIT)](LICENSE.md)

Copyright © 2015 [Kenneth Ormandy](http://kennethormandy.com)

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