Strapi URL alias plugin
Unique, flexible and autogenerated URL aliases for your Strapi managed web content.
✨ 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
⏳ Installation
Install the plugin in your Strapi project.
# using yarn
yarn add strapi-plugin-url-alias
# using npm
npm install 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
- For general help using Strapi, please refer to the official Strapi documentation.
- You can contact me on the Strapi Discord channel.