Customizing URL Generation for Database-Driven Pages

When you are building database-driven pages, typically you need to pass one or more values to the page. These values determine what is displayed. For an item detail page, this would be an identifier for the item; for a category page, it would typically be value of one or more taxonomy terms.

The default mechanism for generating these URLs in the Webvanta system is to use a combination of the numeric database ID and a URL-safe version of the item's name. The database ID provides a guaranteed unique identifier, and the name makes the URL keyword-rich.

You may want to get rid of the numeric IDs, however, and you may also want to use URLs that are different from the item's name. We have recently introduced two major new features to enable this flexibility:

  • Item pages that use an editable permalink name and optionally a permalink date, and require no database IDs
  • A new type of page, the "Variable" page, to which you can pass any (reasonable) number of variables that are then used on the page to set taxonomy values, item names, or whatever you want.

Examples of Item Page URLs

Using the default mechanism, for example, a blog post might have a URL of something like:

www.mysite.com/post/123456-title-of-my-article

With the new flexible item page URL scheme, you can have the URL be:

www.mysite.com/post/title-of-my-article

Or, to help ensure that you don't have two articles trying to use the same URL, you can use the date as part of the URL:

www.mysite.com/post/2012-06-20/title-of-my-article

This is a common URL scheme for blogs. When converting an existing blog to the Webvanta platform, you can use this URL scheme to match the URLs between the old and new sites, minimizing the number of redirects that must be set up.

Examples of Variable Page URLs

With the default mechanism for creating a category page, you'd have URLs like:

www.mysite.com/topic/654321-sausalito

Using the new Variable page type, instead of the older Category page type, you can now use URLs like:

www.mysite.com/topic/sausalito

And, if you want to pass in more than one value, you can keep adding slashes and values:

www.mysite.com/topic/sausalito/boat-rentals

In this case, "topic" is the page slug, and "sausalito" and "boat-rentals" are variables that are passed into the page and can be used to select information from the database.

Implementing Custom URL Schemes

Refer to the following articles for the details of how to set up URL schemes: