# simple-site-aggregate

> Aggregator plugin for simple-site.

Latest version **0.0.19** (published 2020-01-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install simple-site-aggregate
pnpm add simple-site-aggregate
yarn add simple-site-aggregate
bun add simple-site-aggregate
```

## 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.19 |
| Published | 2020-01-07 |
| First published | 2017-03-12 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 179.9 KB |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Stefan Niederhauser |
| Maintainers | nidi |

## Links

- npm: https://www.npmjs.com/package/simple-site-aggregate
- Repository: https://github.com/Schaltstelle/simple-site-aggregate
- Homepage: https://github.com/Schaltstelle/simple-site-aggregate#readme
- Issues: https://github.com/Schaltstelle/simple-site-aggregate/issues
- npm.io page: https://npm.io/package/simple-site-aggregate

## Dependencies (7)

- [chalk](https://npm.io/package/chalk.md) 3.0.0
- [debug](https://npm.io/package/debug.md) 3.1.0
- [moment](https://npm.io/package/moment.md) 2.24.0
- [cheerio](https://npm.io/package/cheerio.md) 0.22.0
- [request](https://npm.io/package/request.md) 2.88.0
- [fs-extra](https://npm.io/package/fs-extra.md) 5.0.0
- [simple-site](https://npm.io/package/simple-site.md) ^0.1.24

## Recent versions

- 0.0.19 (latest) — 2020-01-07
- 0.0.18 — 2019-06-10
- 0.0.17 — 2019-06-05
- 0.0.16 — 2019-06-05
- 0.0.15 — 2019-06-04
- 0.0.14 — 2018-05-01
- 0.0.13 — 2018-05-01
- 0.0.12 — 2018-05-01
- 0.0.11 — 2018-05-01
- 0.0.10 — 2018-05-01
- 0.0.9 — 2018-05-01
- 0.0.8 — 2018-03-06
- 0.0.7 — 2017-11-30
- 0.0.6 — 2017-04-29
- 0.0.5 — 2017-03-26
- … 4 more at https://npm.io/package/simple-site-aggregate/versions

## README

# simple-site-aggregate
[![Build Status](https://travis-ci.org/Schaltstelle/simple-site-aggregate.svg?branch=master)](https://travis-ci.org/Schaltstelle/simple-site-aggregate)
[![codecov](https://codecov.io/gh/Schaltstelle/simple-site-aggregate/graph/badge.svg)](https://codecov.io/gh/Schaltstelle/simple-site-aggregate)
[![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0)

A [simple-site](https://github.com/Schaltstelle/simple-site) plugin that aggregates html snippets from other pages.

## Installation
Install with `npm install -g simple-site-aggregate`. 

Add `_plugins/index.js` containing the line `require('simple-site-aggregate');`.

## Usage
Aggregate a page using a handlebars tag:
```
{{{aggregate "http://my-site/my-page.html" "_parsers/my-site.yaml" "_templates/output.html" 300}}}
```

`http://my-site/my-page.html` is the page that should be aggregated.

`_parsers/my-site.yaml` defines how to extract data from the HTML file:
```yaml
selectors:
    title: header.post-header h1
    content: article.post-content
    image: .blog-meta img [src]
    published:
        - parseDate
        - span.date
        - DD.MM.YYYY
static:
    name: My Name
```

The values in `selectors` are CSS selectors that are applied to the HTML file. 
The first matching tag is processed as follows:  
- If the value ends with a bracketed value (`.blog-meta img [src]`) the result is the value of an attribute (`src`).
- If the value ends with a bracketed dot value (`div [.left]`) the result is if the tag has the given CSS class.
- If the value is an array, the first entry is a parser function and the second entry a CSS selector. 
 The remaining entries are parameters to the parser function. 
 The result is the tag's content applied to the parser function. 
- Otherwise, the result is the content of the tag.
 
`static` contains static strings.

`_templates/output.html` is the template to be used to generate output.

`300` is an optional value defining the maximum length of the values.

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