Build shorter shelves by cutting the shelf to length. Glue a filler block flush with the end and nail each side with small brad nails.
Use needle-nose pliers or a Popsicle stick with a split end to hold the 1-in. brads while nailing.