Skip to main content

Redesign: Pagination

I had enough posts under my belt on this blog that it was time to introduce pagination. Since I display the full content of my posts on my main page, I chose to only show three per page.

Doing this in CraftCMS was surprisingly easly. I just followed the tutorial in their knowledge base which had me up-and-running in no time.

This entailed me changing the way I accessed posts to this:

{% paginate craft.entries().section('blog').limit(3) as pageInfo, pageEntries %}

Then adding this to the bottom of my main-content area to provide for the actual paging.

  <nav>
    {% if pageInfo.prevUrl %}<a href="{{ pageInfo.prevUrl }}">Previous Page</a>{% endif %}
    {% if pageInfo.nextUrl %}<a href="{{ pageInfo.nextUrl }}">Next Page</a>{% endif %}
  </nav>

After a small bit of style tweaking for the links at the bottom, it was all done.

Pagination to previous/next post

All I needed after that was a link at the bottom of a single post, to link to the previous/next one. And it was pretty much the same exact code, so not worth repeating.

Next Up

There are some tweaks here and there I'll get around to at some point, but I think this will be the last post about the build-up of the new site. Maybe I can get a designer friend to do up something a bit fancier for the design at some point down the road.

For my day job, I primarily develop in Ruby on Rails, so I'll start posting more about Ruby/Rails.

Redesign: CraftCMS Upgrade and Initial Design

I recently upgraded to CraftCMS v5.

I host on my own server and upgrading meant upgrading PHP to a supported version. Luckily, this didn't seem to pose a problem with the few other sites I host and maintain. But it was the most difficult part of the overall upgrade. CraftCMS's upgrade process could not have made it any easier.

The upgrade also meant a switch from the Redactor plugin I was using to write my posts to the CKEditor plugin which seems to have replaced it. This too was an easy switch. Overall, I've remained impressed by CraftCMS.

Site Design

I felt I was taking too long figuring out a site layout and design, so I just got to a point where I felt happy enough to continue on with other stuff, like adding pagination for my posts since I'll need that soon anyway.

Most pre-existing templates assume you want to have a lot of photos. I may upload a few at some point but it's primarily text-only. Doesn't give me a lot of options to choose from since I'm a programmer, not really a designer. I'll come back to it, but I don't want to get stuck on it for it.

The existing site leverages some css-grid and flex CSS to make the site responsive. The header/nav area are a bit clunky right now, but it'll do until I want to dive into it more.

Next up, I'll get into some CraftCMS coding to maybe show the most recent five posts on my home page and allow you to click a link to go back in time from there.

RailsConf and Site News

First off, RailsConf 2024 is in Detroit in a few weeks, and I'm attending. If you're reading this, it's likely that you know me somehow. My facial hair is likely more gray now, but I hope I'm still recognizable.

While I haven't posted about any site progress, I've been playing with colors/fonts a bit but haven't found anything I'm in love with.

And then CraftCMS v5 was announced so I'm looking into upgrading. I think I'm good except it requires me to upgrade the version of PHP on my server which I'm not looking forward to. If the site's broken, it's probably because I'm in the middle of that.

In the meantime, if you're at RailsConf, I hope we can catch up.

in News