Building 24 ways on Perch Runway

This year is the tenth season for our web design and development advent calendar 24 ways. Back in 2012 we switched the site to run on Perch, and this year I rebuilt it using Perch Runway.

In this post I thought it would be interesting to highlight some of the ways we’re using Perch Runway features and how it differs from the way the site was structured in Perch.

The Perch build

The site is based around yearly sets of twenty-four articles. In Perch I’d organised these into a page per year (/2012, /2011 etc) with an ‘Articles’ region on each page. The region held the twenty-four articles for each year.

This was long before the native Categories functionality in Perch, so I’d then created a page with a ‘Categories’ multiple item region. This listed our categories, and I then used a dataselect field to place each article into a category. This enabled us to produce the category-based article listings.

The more complex part was the relationship between the articles and the authors. Authors were held in an ‘Authors’ region on the /authors page. This region had around 125 authors, including first and last names, website and Twitter URLs, and a short biography.

I could have used a similar approach as used with the categories, with a dataselect field to relate the author’s slug to the article. That would have left me needing to perform an author lookup for items on the listing pages (like the home page) which in 2012-era Perch wasn’t possible. Instead, I created a custom field type called related which cached a copy of all the author data against the article.

The downside to this approach with the authors was that if author content changed (like an updated bio) the articles needed to be republished to pick up the change. A minor inconvenience, but it all worked quite well.

Rebuilding with Perch Runway

We launched Perch Runway this year, aimed at sites larger than the typical Perch site. That means we can focus on adding the sorts of features that would be unnecessary for smaller sites, but really helpful for larger ones.

One of those key features for 24 ways is collections. Collections are like super-charged multiple item regions. They’re not tied to a specific page, and they include per-item versioning, draft and undo. For 24 ways, this meant that we could import our 216 articles from nine regions into one single collection without suffering any editing slow-down. In fact, everything immediately got faster.

The same was true for our Authors region, which was beginning to get harder to manage with 125+ items. I imported that region into an Authors collection, leaving me with a collection of Authors and one of Articles, and then just a set of pages to display that content in different ways.

I migrated the old categories page over to using the new Categories app (I would have been able to do this with Perch, too), and then took great pleasure in deleting a load of old pages that had become unnecessary.

The other key Runway feature that I was able to make use of was content relationships. This enabled me to replace my old custom related field type with a proper dynamic relationship between articles and authors, with a native way to do things like listing articles by an author and so on. And when the author details change, no need to republish!

Automating our schedule

Whereas in 2005 it seemed like a perfectly reasonable thing to be awake at midnight to launch an article, these days I’m more inclined to be tucked up in bed. That makes automation more important.

In both the Perch and Perch Runway versions, I managed this by filtering on the page to include only articles with a past or current date. Future articles are excluded, so once an article is primed and ready, it’ll become live as the clock ticks over midnight.

Less straightforward was tweeting out a link to the article. In the past I managed this with some cobbled-together command line PHP, activated by a cron job. This year I wanted something a bit more slick, so I added scheduled tweeting to the Perch Twitter app. This enables me to set up tweets to go out at midnight, and again as the working day begins in the UK and then in the US.

In conclusion

In all, the switch to Perch Runway took about a day to complete. That was nearly all routine work, with nothing particularly taxing or tricky – just restructuring using the tools in Runway and then updating my pages and templates to pull content from the right places.

I feel like with the switch to Perch Runway we have a solid platform for the site that should see us well into future years as more content gets added and traffic increases.