Whisk together flour and salt in a medium bowl. In a separate large bowl, beat the softened butter and sugar with an electric mixer until light and fluffy, about 2-3 minutes.
Add egg yolks one at a time, beating well after each addition. Mix in vanilla and almond extracts until just combined.
Gradually add the flour mixture on low speed until a soft dough forms. Be careful not to overmix – stop as soon as the flour disappears.
Shape the dough into a disk, wrap in plastic wrap, and refrigerate for at least 1 hour.
Preheat your oven to 350°F (175°C) and line baking sheets with parchment paper. Mix blackberry jam with lemon juice in a small bowl to loosen the consistency.
Remove dough from refrigerator and let it soften slightly, about 5-10 minutes. Roll dough into 1-inch balls. If using nuts, lightly brush each ball with beaten egg white and roll in chopped nuts.
Place balls 2 inches apart on prepared baking sheets. Press your thumb or the back of a rounded 1/2 teaspoon measuring spoon into the center of each cookie to create a deep indentation.
Fill each indentation with about 1/2 teaspoon of the prepared blackberry jam mixture. Avoid overfilling to prevent jam from bubbling over during baking.
Bake cookies for 12-14 minutes or until edges are lightly golden. Rotate the pan halfway through baking time for even baking.
Allow cookies to cool on the baking sheets for 5 minutes before transferring to wire racks to cool completely.
Once cookies are completely cool, dust lightly with powdered sugar if desired.