Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dwtechs/slughorn.js
Slugify URLs with SEO optimization
https://github.com/dwtechs/slughorn.js
javascript seo seo-optimization slug slugifier slugify url-slug
Last synced: about 1 month ago
JSON representation
Slugify URLs with SEO optimization
- Host: GitHub
- URL: https://github.com/dwtechs/slughorn.js
- Owner: DWTechs
- License: mit
- Created: 2021-01-19T20:56:38.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-03-13T13:30:11.000Z (almost 4 years ago)
- Last Synced: 2024-08-10T10:39:33.069Z (5 months ago)
- Topics: javascript, seo, seo-optimization, slug, slugifier, slugify, url-slug
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![License: MIT](https://img.shields.io/npm/l/@dwtechs/slughorn.svg?color=brightgreen)](https://opensource.org/licenses/MIT)
[![npm version](https://badge.fury.io/js/%40dwtechs%2Fslughorn.svg)](https://www.npmjs.com/package/@dwtechs/slughorn)
[![last version release date](https://img.shields.io/github/release-date/DWTechs/Slughorn.js)](https://www.npmjs.com/package/@dwtechs/slughorn)
![Jest:coverage](https://img.shields.io/badge/Jest:coverage-100%25-brightgreen.svg)
[![minified size](https://img.shields.io/bundlephobia/min/@dwtechs/slughorn?color=brightgreen)](https://www.npmjs.com/package/@dwtechs/slughorn)- [Synopsis](#synopsis)
- [Installation](#installation)
- [npm](#npm)
- [Yarn](#yarn)
- [Usage](#usage)
- [ES6](#es6)
- [CommonJS](#commonjs)
- [IIFE](#iife)
- [API Reference](#api-reference)
- [Contributors](#contributors)
- [License](#license)
- [Stack](#stack)## Synopsis
**[Slughorn.js](https://github.com/DWTechs/Slughorn.js)** is an open source library that transforms string value to a url slug optimized for SEO.
- Very lightweight
- Thoroughly tested
- Works in browsers and Node.js
- Old browsers support (IE9)## Installation
### npm
```bash
$ npm i @dwtechs/slughorn
```### Yarn
```bash
$ yarn add @dwtechs/slughorn
```## Usage
### ES6 / TypeScript
```javascript
import { convert } from "@dwtechs/slughorn";const url = 'Hello World'; // A sentence to be slugified
let slug = convert(url); // hello-worldconst options = {separator: '_', maxLength: 8 };
slug = convert(url, options); // hello_wo
```### CommonJS
```javascript
const slughorn = require("@dwtechs/slughorn/dist/slughorn.cjs");var url = 'Hello World'; // A sentence to be slugified
var slug = slughorn.convert(url); // hello-worldvar options = {separator: '_', maxLength: 8 };
slug = slughorn.convert(url, options); // hello_wo
```### IIFE
```html
```
```javascript
var url = 'Hello World'; // A sentence to be slugified
var slug = Slughorn.convert(url); // hello-worldvar options = {separator: '_', maxLength: 8 };
slug = convert(url, options); // hello_wo
```## API Reference
```javascript
convert(url: string, options?: Options): string|false {}
interface Options {
separator?: string; // a string to replace spaces. Default to '-'
maxLength?: number; // The max length of the slug. Default to 80
seo?: boolean; // SEO optimization. Default to 'true'
}```
## Contributors
Slughorn.js is still in development and we would be glad to get all the help you can provide.
To contribute please read **[contributor.md](https://github.com/DWTechs/Slughorn.js/blob/main/contributor.md)** for detailed installation guide.## Stack
| Purpose | Choice | Motivation |
| :-------------- | :------------------------------------------: | -------------------------------------------------------------: |
| repository | [Github](https://github.com/) | hosting for software development version control using Git |
| package manager | [npm](https://www.npmjs.com/get-npm) | default node.js package manager |
| language | [TypeScript](https://www.typescriptlang.org) | static type checking along with the latest ECMAScript features |
| module bundler | [Rollup.js](https://rollupjs.org) | advanced module bundler for ES6 modules |
| unit testing | [Jest](https://jestjs.io/) | delightful testing with a focus on simplicity |