Implementation idea: .do templates
December 3rd, 2007 — 10:05 am —It’s been awhile since I’ve posted, so: “Hello everyone!”
I’m tossing around a new idea for slate, and I thought I’d post it here to get some feedback. The idea revolves around the concept of “behaviors” for pages in slate. Please bear with me as this is going to be a messy post – the ideas are still swirling around my head.
Current implementation
First, some background information: when a request comes in, slate extracts the path and attempts to find a page matching the path. If it can’t find a match, it attempts to find a “behavior” matching the path. If that succeeds, the behavior is executed (which handles rendering the page based on the path).
The idea is that you assign a page, say blog, the blog behavior, and slate will now know that the page has certain routes. That is, /blog/2007, etc.
Well, that’s all well and good, but there are problems with this implementation. In short, it’s messy. It’s also confusing for the user. So, I’m planning on doing away with the current implementation, opting for something a bit easier to manage.
The .do template
The new idea is this: specialized theme templates, say blog.do.rhtml that handle the behavior without configuration. How will this work? When a request comes in, slate will check to see if the path contains .do. If there’s a match, it will extract that portion of the path and render the associated template.
For example, /blog.do/1/2007 would render blog.do. I’m thinking there will also be a blog.do.rb file which will act as a pseudo-controller for handling these .do templates. Or, maybe the theme will support a blog.do directory, containing custom view templates. Obviously, the details haven’t been worked out yet ;-)
Pros and cons
- Pros
- Consistent URLs for behaviors (blogs will always reside at
/blog.do/:id) - Less configuration (no need to create a page and assign it a behavior)
- Consistent URLs for behaviors (blogs will always reside at
- Cons
- Less end-user control of (no more /something/blog)
- Slightly more ugly URLs
- How to provide editable areas for behaviour-driven pages?
Thoughts?
Clearly, this concept is still up in the air. But if you can understand at all what I’m going for, please feel free to post your thoughts :-)
About slate
slate is a content management system (CMS) developed using Ruby on Rails focused on rapid production of traditional websites created by WVU Web Services. Read more about why we created slate and a longer list of features of slate. You can also check out a list of sites using slate. If you have questions or comments let us know but if it's a question about open sourcing slate have a look at this article first.Archives
Recent articles
- No Wonder Rails Is Default in Mac OS X Server...
- Good News: An Open Sourced slate Is Coming
- The WVU Open Source License
- Implementation idea: .do templates
- Keeping slate Humming - Part 1
- Campfire for Design & Keeping Your Tag Cloud Running
- Custom configuration settings made easy
- HOW-TO: Add a Gallery to Your Site
- JSONRequest.post Example
- Miscellaneous
Articles
Assigning pages behavior seems to make sense, since it’s a CMS and users can manage their content how they see fit. And to me, implementing your
blog.doidea wouldn’t take away from that, but it’d seemingly make it much easier for you and the users because it would just work.I’m fairly picky about URLs, but that’s probably because I’m fairly picky about most things in my life. Anyway,
/blog.do/2007is a little more ugly than/blog/2007, but I think the fact that it takes care of itself overrides that. Plus, I think I’m picky about URLs because I’m a developer. The average user won’t care about that at all most likely. What about/blog/do/2007? Eh… I don’t know… I think I likeblog.dobetter. I like the way it feels like it’s saying “do this” instead of a parameter. And I really like the consistency that all blogs would reside at/blog.do/:id/.As far as the rest of it, I don’t think I could contribute to the issues of editable areas and directory or
blog.do.rb. But from these spinning ideas, it seems like you’re on to something.Who knows, it’s about 30 hours past the time you posted this… you could already have it done by now!
Add comment
You are adding a new comment