Begin by peeling the pineapples and cutting them into chunks. Place the pineapple chunks in a blender and pulse until you achieve a smooth puree.
In a saucepan, combine the pineapple puree, sugar (adjusting to taste), lemon juice, and cloves if using. Cook over medium heat, stirring occasionally, until the mixture thickens and becomes jam-like in texture. This should take about 20-30 minutes. Once done, remove from heat and let it cool completely.
In a large mixing bowl, beat the room-temperature butter with an electric mixer until creamy. Add the sweetened condensed milk and mix until well combined. Next, add the egg yolks one at a time, mixing well after each addition.
In another bowl, sift the all-purpose flour. Gradually add the flour to the butter mixture, mixing until a soft dough forms. You may need to use your hands to bring the dough together fully.
Wrap the dough in plastic wrap and refrigerate for at least an hour. This helps the dough firm up, making it easier to roll out.
Preheat your oven to 350°F (175°C). On a floured surface, roll out the chilled dough to about 1/4 inch thick. Use a cookie cutter to cut out desired shapes. Place half of the cutouts on a baking sheet lined with parchment paper.
Spoon a small amount of the cooled pineapple filling onto the center of each cookie cutout on the baking sheet. Be careful not to overfill.
Place the remaining cutouts over the filled cookies, pressing the edges gently to seal. You can crimp the edges with a fork for a decorative touch.
In a small bowl, whisk together the egg yolks and condensed milk. Brush this mixture over the tops of the cookies for a golden finish.
Bake in the preheated oven for about 15-20 minutes or until the edges are lightly golden. Keep an eye on them; you don’t want them to brown too much.
Once baked, remove the cookies from the oven and let them cool on a wire rack. These are best enjoyed fresh but can be stored for later.