Webiny

Loading, please wait ...

How Webiny treats URLs

About the author

What is a URL?

Before we start with system details, it's important to know what is a URL and from which parts it consists. 

URL is short for Uniform Resource Locator. Each URL consists out of a scheme, domain (or host) and a path.

Lets look at this url http://www.webiny.com/blog/ the identified parts are:

  • scheme: http
  • host: www.webiny.com
  • path: /blog/

The scheme and host are defined by your domain and you cannot change them, but the path is defined within your system, in this case Webiny CMS.

The process

Every page inside Webiny CMS has a unique path. This path is called a page slug. To build a page slug the following process is used:

  1. Get domain URL pattern
  2. Get content category URL prefix
  3. Get page slug
  4. Combine all rules into a unique URL 

If you have multiple domains in your Webiny account, you can set these settings for each domain and in some cases, for each language.

Domain URL pattern

The domain URL pattern controls how the generated page slug and domain name are joined together. Using this setting you can control how your URL will look like when it comes to things like file extensions and language identifiers. You can also append some words and characters to your pattern.

Pattern URL
{page_url}/ http://www.webiny.com/blog/
{page_url}.html http://www.webiny.com/blog.html
{page_url}-page.web http://www.webiny.com/blog-page.web
{language_code2}/{page_url} http://www.webiny.com/en/blog
{language_code3}-{page_url}.html http://www.webiny.com/eng-blog.html

You can control the pattern for your every domain separately. If you have multiple languages in your account, than the language identifier (either {language_code2} or {language_code3}) must be present in the pattern.

Content category prefix

Each page created with Webiny CMS must belong to a content category. Common content categories are blog posts, news articles and static pages. Each content category can have, among other options, a default URL prefix. The prefix is appended automatically in front of your page slug. Content category URL prefix can be a static word or something dynamic like parent page slug or current date. Here are few examples of that:

URL prefix Page slug URL
blog/ post1 http://www.webiny.com/blog/post1/
product- phone http://www.webiny.com/product-phone/
{parent_slug}/ sub-child http://www.webiny.com/parent/child/sub-child/
blog/Y/m/d/ my-blog-post http://www.webiny.com/blog/2012/04/05/my-blog-post/

In first example using 'blog/' URL prefix we set a rule that every blog post is anchored inside a 'blog' parent. This way you get a much better organisational structure on your site.

The second rule is similar to the first one, but instead of a slash it uses a minus symbol for separation.

The third rule is very useful for sites with a much deeper content organisation. Lets say you have a page 'iPhone 4GS' (iphone-4gs) that is a sub-page of 'Apple' (apple) who is also a sub-page of 'Phones' (phones).Using the '{parent_slug}' content category URL prefix the generated URLs will look like this:

 

  • Phones: http://www.mydomain.com/phones/
  • Apple: http://www.mydomain.com/phones/apple/
  • iPhone 4GS: http://www.mydomain.com/phone/apple/iphone-4gs/

 

And this is all done automatically with an option to override the generated URL per page.

The forth example is a common structure for blogs.

Page slug

When creating a new page, Webiny CMS auto-generates a page slug based on current page title. The generated slug can be easily edited by clicking on the slug which will activate the edit-mode.

Also while creating a page, Webiny CMS will give you a preview of how the end URL will look like while at the same time taking into account all the rules like domain URL pattern and content category prefix.

301 Module

For customers that are transferring their existing pages to Webiny, and in the process they are changing their URLs, we have prepared a module that will enable them to redirect the old URLs to new ones, without losing their page rank and visitors that land on the old URL. 

The old and new URLs can be entered manually or you can upload a CSV file containing old URLs in first row and new URLs in second row. The system will read the file and import all URLs to the list. Every time someone opens an old URL, system will detect that, issue a 301 header and redirect the user to the new URL.

Outro

I hope you got a preview of possibilities provided within Webiny CMS when it comes to handling and controlling your websites' URL structure.

If you have any questions or suggestions please feel free to comment.

Subscribe


Don't worry we will not use your email for spam