Paths and URLs

Posted by Jim Gay on Wednesday, November 03, 2010 | |

At the heart of Radiant’s Page model has been the find_by_url method.

It takes a path, and finds the proper bit of content to display. I wrote a detailed explanation of how find_by_url works on my blog.

In the future things like this will be changing. Our url and find_by_url methods and their ilk haven’t truly had anything to do with URLs, but with paths. So we’re fixing that. The next release will refer to “path” where “url” used to be but don’t worry, everything will work just as you expected if use the current url methods.

To get the same behavior, you’ll need to use methods like path or find_by_path since that’s what you’re really after. This commit shows some of the changes that are upcoming. For now, everything will work the same. We’ve aliased the methods for the next release of Radiant so that your page’s url and path are the same. But they won’t be the same in subsequent releases.

A url method will return an actual URL such as http://radiantcms.org/blog instead of just /blog. We have an open issue related to this at github which describes the same thinking laid out here.

If you’re running on edge, start your switch now.