Preheat your oven to 350°F (175°C) and line a large baking sheet with parchment paper.
In a large mixing bowl, cream the softened butter and sugar until light and fluffy.
Add the eggs one at a time, mixing well after each addition. Mix in the vanilla extract and almond extract.
In a separate bowl, whisk together the flour, baking powder, and salt. Gradually mix the dry ingredients into the wet ingredients just until a thick dough forms.
Fold in the chopped pistachios. If the dough seems too wet, you can chill it in the fridge for 30 minutes to an hour.
Divide the dough in half and shape each half into a rectangular loaf about 12 inches long and 1½ inches wide on the prepared baking sheet, leaving space between them.
Bake for 25 to 30 minutes, until lightly golden and firm to the touch.
Let the loaves cool for about 10 minutes, then reduce the oven temperature to 325°F (160°C).
Slice the loaves diagonally into ½-inch pieces and place them cut side down on the baking sheet.
Bake for 10 to 15 minutes, until lightly golden. Remove from the oven, flip each slice, and return them to the baking sheet.
Bake for another 10 to 15 minutes, depending on how crunchy you want them.
Transfer the biscotti to a wire rack and let them cool completely.
For the optional white chocolate finish, melt white candy melts according to the package instructions, then stir in a little coconut oil as needed for a smoother drizzle. Or, melt white chocolate chips in a microwave-safe bowl in 20-second intervals, stirring between each, until smooth. Drizzle over the cooled biscotti or dip one end, then let the coating set before storing.