Preheat your oven to 350°F (175°C). Grease and flour two 9-inch round cake pans.
In a mixing bowl, combine the flour, granulated sugar, ¼ cup cocoa powder, baking powder, and salt. Mix well.
In another bowl, beat the softened butter, milk, eggs, and vanilla extract together until well combined.
Gradually add the wet mixture to the dry ingredients, mixing on medium speed until just combined. Do not overmix.
Divide the batter evenly between the prepared cake pans. Bake in the preheated oven for 25 minutes or until a toothpick inserted in the center comes out clean.
Allow the cakes to cool in the pans for 10 minutes before transferring them to a cooling rack to cool completely.
While the cakes are cooling, combine the cooled espresso and coffee liqueur (if using) in a shallow dish.
In a mixing bowl, whip the heavy cream until soft peaks form. In another bowl, whisk together the mascarpone cheese and powdered sugar until smooth.
Gently fold the whipped cream into the mascarpone mixture until well blended.
Once the cakes have cooled, slice each layer horizontally to create 4 thin layers (2 from each cake).
Begin assembling the cake by placing one layer on a serving plate. Brush the top generously with the espresso mixture.
Spread a layer of mascarpone cream over the soaked layer. Repeat this process with the remaining cake layers, alternating between soaking the layers and adding cream.
Once the final layer is added, dust the top with the remaining cocoa powder and garnish with dark chocolate shavings if desired.
Refrigerate the assembled cake for at least 4 hours or overnight to allow the flavors to meld.