npm package: @oak-digital/strapi-plugin-url-alias
Description: Unique, autogenerated URL paths.
Author: Boaz Poolman
Latest version: 1.0.0-oak-alpha.14

<div align="center">
<h1>Strapi URL alias plugin</h1>
	
<p style="margin-top: 0;">Unique, flexible and autogenerated URL aliases for your Strapi managed web content.</p>
	
<p>
  <a href="https://www.npmjs.org/package/@strapi-community/strapi-plugin-url-alias">
    <img src="https://img.shields.io/npm/v/@strapi-community/strapi-plugin-url-alias/latest.svg" alt="NPM Version" />
  </a>
  <a href="https://www.npmjs.org/package/@strapi-community/strapi-plugin-url-alias">
    <img src="https://img.shields.io/npm/dm/@strapi-community/strapi-plugin-url-alias" alt="Monthly download on NPM" />
  </a>
  <a href="https://codecov.io/gh/strapi-community/strapi-plugin-url-alias">
    <img src="https://img.shields.io/github/actions/workflow/status/strapi-community/strapi-plugin-url-alias/tests.yml?branch=master" alt="CI build status" />
  </a>
  <a href="https://codecov.io/gh/strapi-community/strapi-plugin-url-alias">
    <img src="https://codecov.io/gh/strapi-community/strapi-plugin-url-alias/coverage.svg?branch=master" alt="codecov.io" />
  </a>
</p>
</div>

## This plugin is in ALPHA state

## ✨ Features

- **Unique URLs** No duplicate URLs possible
- **Auto generated** Automatically generated based on a pattern
- **Flexible** Overwrite single URLs
- **Public endpoint** Get your page by path with the `/get` endpoint
- **Auto slugify** The URLs will automatically be slugified to ensure valid paths

## ✨ #StrapiPluginWeek

This plugin was made as an entry to the <a href="https://lu.ma/strapihacks">Strapi Plugin Week</a> hackathon.

See the <a href="https://www.loom.com/share/5409b9415e3e4b66ad27eab967c393d0">demo video</a>.

## ⏳ Installation

Install the plugin in your Strapi project.

```bash
# using yarn
yarn add @strapi-community/strapi-plugin-url-alias

# using npm
npm install @strapi-community/strapi-plugin-url-alias --save
```

After successful installation you have to rebuild the admin UI so it'll include this plugin. To rebuild and restart Strapi run:

```bash
# using yarn
yarn build
yarn develop

# using npm
npm run build
npm run develop
```

Enjoy 🎉

## 🖐 Requirements

Complete installation requirements are the exact same as for Strapi itself and can be found in the [Strapi documentation](https://strapi.io/documentation).

**Supported Strapi versions**:

- Strapi 4.3.2 (recently tested)
- Strapi ^4.x

(This plugin may work with older Strapi versions, but these are not tested nor officially supported at this time.)

**We recommend always using the latest version of Strapi to start your new projects**.

## 💡 Usage
This plugin extends the Strapi edit view to add a 'URL alias' sidebar. In the sidebar you are able to add a URL alias for your page.

You can either overwrite the URL, or have it be generated based on a URL pattern.

## 🔌 URL pattern
To create dynamic URLs this plugin uses **URL patterns**. The URL pattern will be used to generate unique URLs based on the data available.

You can add URL patterns in the settings section of the plugin.

```
/pages/[my-title-field]
```

Fields can be injected in the pattern by escaping them with `[]`.

The following field types are allowed in a pattern:

- `id`
- `uid`
- `string`

## 📺  Endpoint

The plugin also comes with an endpoint you can use to find _any_ content by path.

#### REST

```js
await fetch(`${API_URL}/api/url-alias/get?path=/about-page`);
// GET /api/url-alias/get?path=/about-page
```

## 🔗 Links

- [NPM package](https://www.npmjs.com/package/@strapi-community/strapi-plugin-url-alias)
- [GitHub repository](https://github.com/strapi-community/strapi-plugin-url-alias)

## 🌎 Community support

- For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/).
- You can contact me on the Strapi Discord [channel](https://discord.strapi.io/).

## 📝 Resources

- [MIT License](LICENSE.md)