Technology Solutions for Everyday Folks
Old computer mainframe tape disks

Time for a Drupal Refresh

So here we are...just over six months into the new Drupal adventure driving the site. Overall I'm much happier with the transition than I'd originally expected, because the general maintenance and upkeep has been pretty much automatic. Scheduled publishing has been a lifesaver, too, because it's a 'set and forget' thing...unless I cross a month's boundary between create and publish dates (more about that in a bit).

Time for a Review

Since both the soft launch (late January through mid-February) and more polished launch/update in mid-March, however, there have been some things that I've been noting or wanting to change. Primary among these is the homepage:

What should I do with it?

What is its purpose?

What is the site purpose anymore?

The site's homepage has been the bane of my concerns with the site forever. For over twenty years it's been this weird mix of 'sometimes personal-ish, mostly professional-ish' ideologies. At one point in time (for a good portion of those twenty years), the purpose was more "sales" related than anything. This made sense for the time when I was actively looking for new clients and providing different types of services that nowadays are more commodities and/or far better left to folks who truly are experts in various areas. I don't build and service hardware anymore, and I have a strong freelance client base that provides me more than enough ongoing work. I don't need to sell myself to new clients.

But as I've said in other posts, I've reached a point of wanting to share more information (the evangelism) than sell a given service. Inspired by others in the greater technical communities I'm involved with, interesting takes on content and sharing of something (even if it's just for Future Me) seems the best purpose of the homepage, but not to get lost with all of the other stuff I still do.

I've curated some content over these past months, and combined with other existential thoughts like those above I decided to showcase just the tech stuff on the homepage. It meets several of my criteria, highlights decent content, shows something more than a bland bit of random text, and cuts out the other, likely non-interesting stuff for folks who might wind up on the site. If they want to learn more about my unique interests or services I can provide...those links are still there. Just not right out front.

Whaddya know, using a real CMS actually makes this change pretty straightforward!

Starting a New View

I'd been fiddling with a new "homepage" view for a while, plugging away at it here-and-there as time would allow. I got it to the point where I knew it would work, wasn't terribly difficult to style, and could be fully cut over in an afternoon. I just had to make some decisions and play around...

Tags

Since I expect most "new" traffic to the site to be driven from technical circles (twitter, github, professional circles), it was trivial to determine the proper tag(s) for homepage content. Drupal views make this literally trivial.

Layout

I'd figured out how to make a decent, succinct-ish layout for the services landing page (view), and used this grid format as my inspiration. I could easily include the first paragraph or so of text, the headline image, title, and date. This would highlight just the opening bit, and also update and rotate in/out on some reasonable interval (based on my desired cadence).

Volume

This one I'm not quite sold on just yet, but as I had more than a dozen items already written with the desired tags I started with 12. That'd wind up displaying a 3x4 grid on the desktop view. When I got to starting to style things, I cranked it down to 9 items (3x3 grid). I'm not sure if that's still "too much," so it's possible I'd narrow it down to the most recent six...but I will likely let analytics give me some data before I make any additional change...for now.

Style Away!

One of the things I've come to love about Drupal is how simple it can be to configure and modify once it's originally set up. This update was no exception.

The trickiest thing about this is really dealing with any changes necessary to the underlying Twig templates and getting the right CSS specificity.

Enter Twig Debugging

If there's one thing you (or Future Me) takes away from this tome, it's to enable Twig debugging (do this by editing /sites/default/services.yml):

parameters:
  twig.config:
    debug: true

Clear some caches and start having fun examining source!

I use both the standard Ctrl-U method (to look for Twig template hooks or places you might need to add a Twig template for your custom modifications) and the baked-in-browser developer tools (for proof-of-concept testing styles).

In this iteration, I didn't need to fiddle with any Twig templates...so it was all pretty much style mods.

Don't forget to shut off Twig debugging when you're done, though...

Time to Cut Over!

With things properly tested and coming back satisfactory, it was time to cut over. And again, Drupal makes this super simple!

I first unpublished the default homepage content (it won't be needed anymore), which made the default frontpage view present as it would for a new Drupal installation.

Then I disabled the frontpage view, which allowed me to change the path for the "new" homepage to be the default. Anyone who happened to view during that 60 seconds of transition would have temporarily received a 404 error.

Voila!

It really was done in an afternoon, and I'm much happier with the look and how it's behaving/appearing.

Some Other Changes

I took the opportunity to fiddle with and fix some various styles, Drupal configuration settings, and some annoying (to me) default image size things. Most of those things aren't noticeable for the majority of folks.

In all of this, I also did a major/minor Drupal update to v.8.7.x. This temporarily left a few of my modules in an unhappy, but working, place. They just needed a few updates, really.

Unfortunately, none of module updates will address my 'across month' issue with aliasing. The user-friendly alias gets created when the post is originally created (in the current month), but the actual node lives based on the publish date (the month following). So when I write a post on the 28th of a month, but it publishes on the 2nd, the alias needs to be manually adjusted. I haven't found a way around this off hand...but maybe I'll put in a feature request with the developer(s) of a couple modules.

Headline image via giphy