Preheat the oven to 200°C (180°C fan oven) Gas Mark 6. Lightly grease a 20 x 30cm traybake tin, then line the base with baking parchment. Roll out the pastry on a floured surface until big enough to line the base of the tin. Prick the base with a fork and chill for 30 minutes.
Bake the pastry for 10 minutes until pale but sandy, then lift out and turn the oven down to 180°C (160°C fan oven) Gas Mark 4. Roughly spread the jam over the base.
For the sponge, whizz together the sugar and coconut in a food processor until the coconut is ground like the sugar. Add the rest of the ingredients to the food processor and whizz until smooth. Spoon into the tin and smooth the top. Scatter over the raspberries, followed by the last 3 tbsp of coconut and bake for 35-45 minutes until golden and firm.
Cool completely in the tin, then slice into bars or squares to serve. For pudding it’s lovely with hot custard, for afternoon tea, try drizzling with a little white icing like a traditional Bakewell tart.