New Pagination and Search for Blog Posts

Feb. 16, 2021

New search and pagination added for Network Automation Nerds Blog Posts


The blog listing page is getting a bit long, so this week I added pagination to the end using this tutorial as a reference:


This lead to another issue of the need to search thru the previous blogs without the need to browse thru all the listings. Luckily, all Wagtail models already has a built-in search shortcut. Since it is based on Django QuerySet, all the filter and properties are very similar:



More Context

It has been about 9 months since I switched my blog posts from the old Blogger site to the site you are looking at. This means the list for posts is getting a bit long. The previous listing would query all posts of a particular model type and list them out on one page. It has the advantage of seeing all pages with titles and a short intro in one page, but of course, scrolling down is a pain in you-know-what.

The reason I choose to build the site using Django and Wagtail is to use the opportunity to learn and grow, but when it comes to adding new features I always start to question this choice. It seems so easy to just go with a WordPress site or else to just get a plugin and 'get it done'. So I have been dragging my feet for a few months. This task has been on my Kanban board since late last year before the Winter break. This past weekend I just decided to at least make some forward progress and started to research for ways to do it. To my surprise, it was surprisingly easy thanks to Django and Wagtail's excellent documentation and community support. This really speaks to the power of Django, in my opinion, that it is a little more work to get started but boy it is so nice to be able to leverage the power of the framework after. Both of the tasks took less than 2 hours of work and I learned something new.


Some thoughts:

  • Just focus on making forward progress.
  • The final task might be easier than you think.
  • Django and Wagtail are super nice.

Hope you and your loved ones are staying safe and healthy.

Happy Coding!


Return to blog