Writers Building Websites

Writers Building Websites

Build a Dynamic Genre Archive in Breakdance

Learn to create a flexible genre archive template in Breakdance, displaying books by category dynamically for better navigation, SEO, and user experience.

Last Updated: 11 December 2024

Introduction

In this lesson, you’ll discover how to craft a dynamic, genre-specific archive template for your author website using Breakdance. By configuring template settings, mapping dynamic data, and utilizing global blocks, you’ll showcase books by genre to help readers navigate your catalog with ease.

Create the Genre Archive

  • Go to Breakdance > Templates
  • Click on Add a Template
  • Choose Custom Template
  • Click continue past the warning
  • The Title is Genre Archive
  • The location is ‘Archive /Taxonomy Archive
  • Add the condition ‘Is Taxonomy’ – ‘is’ – ‘Genre – All genres’
  • Click save
  • Edit the new template in Breakdance
  • Add a section
  • Use the Hero Section

Add an Archive Title

We’ve set this template to display for any genre. When anyone clicks links for the Thriller or Cozy Mystery genre on the website Breakdance will use this template to display the results. Because of that we are going to use as much dynamic data as possible starting with the title.

  • Add an Archive Title Element
  • Set the tags to H1

When I use the preview drop down to switch between the Thriller and Cozy Mystery genres you can see the title changes. I don’t need the archive prefix on the title so I’m going to turn that off.

  • Disable Prefix

Add Genre Description

Back when we added the Genre taxonomies I entered a description of each one as well. Here is one of the spots we get to use it.

  • Add a text element underneath the archive title
  • Map the text element to the Archive – Archive Description

Just like with the Archive Title the Archive description will pick up which genre is being looked at and display the appropriate description.

Add Other Books Max Post Loop

Next we want to add all books with the matching genre tag to the archive page.

  • Add a Post Loop Builder
  • Set the Global Block to Other Books Min
  • Set pagination to numbers
  • Show all numbers
  • Set the design preset to Book Grid
  • Click Save
  • Exit to front end

Sort Order

From the front end of the website I can check what each genre looks like. Switching between Thriller and Cozy Mystery correctly displays all the books categorised as that genre. As more books get added the archive will add pagination numbers to help navigate readers through the books.

But there is something you may not like.

The sort order.

The default query for all post Archives, including custom post archives, is to display the latest books first. You may not mind that but if you do there is currently no way to change it without code.

Let me show you what I mean.

  • Open the Genre Archive with Breakdance
  • Click on the Post Loop Builder Element
  • Go to Query
  • Custom
  • Edit Query

No matter what options I set inside here there is no way to tell the archive to only show books tagged with the currently selected archive. Instead it shows ALL books and that’s not what we want.

Only when I delete the custom query does it go back to the default query and only show the books from the currently selected genre.

It is possible to customise WordPress archive queries with php code but that’s a deep rabbit hole to go down especially as we add more custom post types and taxonomies to the website.

Instead we are going to stick with the no code solution of conditional templates inside breakdance starting with our Series Archives we are going to build next.

Summary

You’ve now learned how to build and fine-tune a genre archive template in Breakdance, dynamically displaying books categorized under each genre. By leveraging global blocks, archive titles, and descriptions, you’ve created a more intuitive, SEO-friendly browsing experience. Although the default sort order may require advanced customization for more control, the no-code solution provides an efficient starting point, guiding readers through your growing collection and paving the way for future enhancements.

Stephen Gordon
Stephen is the founder of Writers Building Websites and brings over a decade of experience as a freelance marketer specialising in publishing. He is also an author.

Index

Copyright © 2024 Writers Building Websites | All Rights Reserved.