Skip to content

QuePlan/strapi-plugin-url-alias

Β 
Β 

Repository files navigation

Strapi URL alias plugin

Unique, flexible and autogenerated URL aliases for your Strapi managed web content.

NPM Version Monthly download on NPM CI build status codecov.io

✨ 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 Strapi Plugin Week hackathon.

See the demo video.

⏳ Installation

Install the plugin in your Strapi project.

# 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:

# 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.

Supported Strapi versions:

  • Strapi 4.1.12 (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

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

πŸ”— Links

🌎 Community support

πŸ“ Resources

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%