I am creating a Books page in Jekyll, where each book is a .md file in a _books directory, and a books.md page that displays each book in a table using the following control structure:
{% assign books = site.books | sort: ‘priority’ %}
{% for book in books %}
I’d like to display the books in a custom sort order. Adding the order in _config.yml does not appear feasible as I may have a hundred books on the page. I can add a “priority” variable in the front matter and sort on that, as shown above. However, I am hesitant to use this method in the event that I’d like to change the priority of a book in the future.
Is there a way I can maintain a custom sort, where it is also feasible to easily alter the ordering of any given book (e.g., move book from index position 10 to position 2 while bumping down all those that were previously at position 2 and below)?
Or is my best bet to write another script that goes through all the files in the _books folder and decrements the priority variable for every book between the old and new priorities for a given book?
I am using Michael Rose’s Minimal Mistakes theme in case that helps.
Thank you!