Making Pages a First Class Citizen

I’ve been designing a blog engine, and one of the tough parts I’ve been dealing with is how to make pages a first class citizen.  In WordPress, you can either have 1 level of pages, or you can have dynamic content.  You can’t do both on the same page.

This is a problem. What if a customer wants a fully functional website built so that the static pages don’t really look or feel like static pages? What if they want the navigation for the pages to be in line with the rest of the site?

While sleeping last night, I had a dream about this, and the answer (weirdly enough) came to me in the dream.

Why not use:

{category}/{page}/{id} OR

{id}/{category}/{page}

That way pages like ‘About’ and ‘Contact Us’ can be placed in a CSS menu like system.

The routing for such a distinction is simple:

routes.Add(“PagesRoute”,

“{id}/{category}/{page}”,

new { controller = page, action = show, category = “”, page = “”, id = 1 },

new { category = @”[A-Z][a-z]”, page = @”[A-Z][a-z]”, id = @”[d+]” }

);

 

The page controller then contains CRUD Methods (perhaps Delete, Edit, Create, and Show), and the Show Action takes in two parameters “category”, “page”, and “id”.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s