An open API service indexing awesome lists of open source software.

https://github.com/teles/link-builder

A automate link building tool perfect for front-end development
https://github.com/teles/link-builder

Last synced: 5 months ago
JSON representation

A automate link building tool perfect for front-end development

Awesome Lists containing this project

README

          




Link Builder


Link Builder


The power to generate your html anchors using javascript.



Perfect for SPAs and SEO.







## Common usage

The `LinkBuilder` function can be used as a constructor or literal function to parse any `String` or `HTMLElement` to include html anchors in it.

Use `LinkBuilder` to easily include anchors to your markup, such as:

**Before LinkBuilder:**
```html

In the field of search engine optimization, link building describes actions aimed at increasing the number and quality of inbound links to a webpage with the goal of increasing the search engine rankings of that page or website.


```

**After LinkBuilder:**
```html

In the field of search engine optimization, link building describes actions aimed at increasing the number and quality of inbound links to a webpage with the goal of increasing the search engine rankings of that page or website.


```

**Used `LinkBuilder` configuration to create above result:**

```javascript
new LinkBuilder(htmlContent, [{
anchor: "https://en.wikipedia.org/wiki/Search_engine_optimization",
keyword: "search engine optimization"
},
{
anchor: "https://en.wikipedia.org/wiki/Backlink",
keyword: "inbound links"
}
])
```

## Installation

```bash
npm install --save link-builder
```

Or get the [latest version from unpkg.com](https://unpkg.com/link-builder@0.6.5/release/link-builder.js).

## Parameters

There are two mandatory parameters for `LinkBuilder`.


``content``:

> is any `String` or `HTMLElement` used as input for `LinkBuilder`.

``replacements``:

> is a Array of Objects containing each one optional and required properties:

### Properties for each replacement:

| property | required | description | example |
|-------------|----------|---------------------------------------------------------|------------------------------------------|
| anchor | true | anchor text to be used as href | https://en.wikipedia.org/wiki/JavaScript |
| keyword | true | String keyword to be matched | Javascript |
| insensitive | false | Boolean to on/off case insentive match. Default `false` | true |
| max | false | Number. Max number of matches for `keyword`. | 3 |

## Examples
Coming soon

## Contributing
Coming soon

## License
MIT - Jota Teles - 2017