Taking Craft CMS for a Spin

Written by activator_admin_91s8 while listening to Release Radar at some point on July 17th.

Craft CMS logo

There are few things that get my brain buzzing like learning new things. So I combined those two things and wrote about a new side project based on learning new things, I built with a new technology.

At Activator, part of what sets us apart from other agencies, is our ability to learn quickly. And with my move to the rapid-paced city of New York, I’m learning at a rate a little quicker than most.

So I decided to build an web app to document what I was learning. It’s made up of a series of categorized blog posts that can be swiped or scrolled through horizontally. Each blog post has a title, introductory paragraph (which I capped at 140 characters, thanks Twitter), custom “read more” text, date and body text. Pretty standard stuff.

Originally, I built it inside of WordPress because I already knew the platform and wanted to be able to add new posts on the fly from the iPhone app. But then I got to thinking, “why not throw another layer on top of this learning thing? I’ll lean on my curiosity and learn a new CMS in the process.” And Craft seemed like the obvious choice and one I’ve been eyeing for a while. It’s ability to handle complex setups is, what I believed, set it apart from the rest. Also its’ price tag. But, there’s an unlimited free version that lets you set up one site. So that’s what I did.

And here’s how it went:

Initial Setup

The install was simple enough, I just followed their instructions. Coming from WordPress made things much easier for me, and was familiar.

Dashboard

The dashboard looks very similar (has the same components) as the WordPress dashboard. Which is to say, it’s pretty useless out of the box.

Adding/editing posts

What I did then was pull over all the blog posts, which Craft handles a bit differently. I didn’t have many, only 5 or so, so I didn’t need an import/export option, although there is a great third-party migrating service. Craft has what is called Entries which, in my case are the equivalent of WordPress’s Pages and Posts, rolled into one. The nice thing about that is that you’re not tied down to just pages and posts. You can name and categorize them however you like, making it much more extensible. The categories can also be categorized (pretty meta, I know). Not necessary for my purposes, but it’s nice to know.

Out of the box, Craft came with everything I needed. No plugins necessary. The only thing I had to set up that was included but not configured were the custom fields for the introductory paragraph and “read more” text. This is where things got interesting.

Configuring Fields

Like the rest of the admin area and documentation, and unlike WordPress, the Settings are laid out in a simple way that actually makes a lot of sense. What I needed was Fields, which was, like everything else, labeled simply. Once I got into Fields, you have the option of adding a new field or group of fields (if I had different types of Fields I wanted to add). Creating a new Field is pretty straightforward and you have a lot of types to choose from, which again, really adds to that flexibility. From a Lightswitch, to Matrices, to Color, it’s becoming clear that extensibility is the primary selling point of this platform. Fields are pretty similar to WordPress’s ACF plugin, only more powerful and since it’s baked in, couldn’t be more seamless. I only needed a text field option, but the number of options available is pretty staggering, especially considering what could be done with each.

Craft CMS - edit admin

Once I created those two fields, I thought the area where I edit the Posts would update automatically. It didn’t. I thought I was doing it wrong, but everything looked like it was set up properly, so naturally I hit Google, and was directed to a page from their documentation that outlined my next steps.

It told me to go into Settings, then Sections to modify the Entry Layout. So basically what I want the page where I edit the Posts, to look like. The option to add a New Tab, and add the new Fields I just created. Mystery solved. Again, there’s so much flexibility to be had here.

Customizing the Template

What I needed to do now was customize the homepage template to display all of my Posts and throw in the custom Fields I created. But let me back up.

The Craft file structure is pretty simple once you identify the patterns. The Twig templating that’s built-in is a dream coming from WordPress. Not to mention including or “extending” core files is a little different but like I said once you get the pattern down, it’s cake. So all I needed to do here was follow the Twig documentation to add a for loop that adds the blog posts I needed in a list. I pulled over all the necessary styles and javascript and VOILA!!

I really look forward to doing more with this CMS. The upfront cost can be a big pill to swallow, but I imagine if you’re dealing with a much larger site with more complex content throughout, it would be well worth the price tag.

A few other goodies

  • Database tools are built in and super simple to implement. So things like database back-up, find/replace and clearing cache you can do right from the settings (no need for 3 different plugins!).
  • URL and file hierarchy is dead simple.
  • The included .htaccess file will redirect all 404s to the homepage by default.
  • There’s a great 3rd-party plugin repository here