Description
We should allow users decide if they want their urls to end with or without a trailing slash in Frontity.
Right now, in order to normalize all the links, Frontity add a trailing slash at the end of all the urls. This is the default behaviour in WordPress and it automatically redirects the url not ending in a slash to the same url with a slash. This is important for SEO purposes because search engines treat these urls separately even though they have the same content.This means you need a redirection and a cannonical url to prevent duplicated content.
However, some users will prefer to keep the urls without the trailing slash. In WordPress, this is possible changing the posts permalink. If you define it like /%postname
instead of /%postname/
all your urls for the posts, categories, pages, etc won’t have the trailing slash.
In Frontity, you can achieve that modifying the normalize
function from your theme as explained in this CodeSandbox, but we should provide an official setting for this.
We shouldn’t only change the url in the nav bar but also all the internal linking. This way, all the links included in the content (in an archive for example), should point to the cannonical url (with or without the slash) that users select to prevent an unnecessary redirection.
Functionalities
- Allow users to select if they want their urls to end with or without a trailing slash.
Requirements
- Combined with the redirections feature, we should handle this redirection, one way or another, from Frontity so it doesn’t affect SEO.
Dependencies
Possible solution
We could have an option in source
to define if you want or not the trailing slash, keeping the default behaviour as it is right now because it is the same as WordPress. Depending the option selected here, we could redirect one way or the other.