Prep the pan and oven. Heat the oven to 350°F (175°C). Grease a 9x13-inch baking pan (or a 10x15 jelly roll pan for a thinner cake) and line with parchment for easy removal.
Toast the coconut topping. Spread the sweetened shredded coconut on a baking sheet and toast in the oven for 4–6 minutes, stirring once, until lightly golden.
Watch closely—it browns fast.
Mix the dry ingredients. In a large bowl, whisk flour, sugar, baking soda, and salt until well combined.
Add the wet ingredients. Add eggs, oil, vanilla, and the entire can of crushed pineapple with its juice. Stir with a spatula until no dry streaks remain. If using, fold in the unsweetened shredded coconut.
Bake. Pour the batter into the prepared pan and smooth the top.
Bake for 25–35 minutes (20–25 minutes for a jelly roll pan), until the center is set and a toothpick comes out with a few moist crumbs.
Cool. Place the pan on a rack and let the cake cool until just warm, about 30–45 minutes. This helps the frosting glide on and meld with the cake.
Make the frosting. Beat cream cheese and butter together until smooth and fluffy, 2–3 minutes. Add powdered sugar in batches, beating until creamy.
Mix in vanilla, salt, and just enough buttermilk or sour cream to reach a spreadable consistency.
Frost the cake. Spread frosting over the warm (not hot) cake. The warmth helps it settle in for that ultra-moist texture.
Finish with toppings. Sprinkle toasted coconut over the frosting. Add nuts or pineapple tidbits if you like.
Chill 20 minutes to set, or serve right away.