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
- Host: GitHub
- URL: https://github.com/teles/link-builder
- Owner: teles
- Created: 2017-09-26T03:54:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-02T13:22:15.000Z (almost 9 years ago)
- Last Synced: 2025-10-25T17:03:03.064Z (9 months ago)
- Language: JavaScript
- Homepage: https://codepen.io/teles/pen/KXaZjN?editors=1011
- Size: 13.7 KB
- Stars: 13
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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