Preheat the oven to 375°F. Grease a baking dish lightly with olive oil.
Place the halved potatoes in a pot of salted water, bring to a boil, and cook until just tender, about 10 minutes. Drain and set aside.
In a large skillet, melt the butter and sauté onion and garlic until fragrant and golden.
Pour in the cream and stir in the rosemary. Season with salt and pepper. Let simmer gently for 5 minutes.
Layer the potatoes in the prepared baking dish, spooning some of the cream mixture over them.
Lay the cod fillets on top and pour the remaining sauce over everything.
Bake for 20–25 minutes, until the cod flakes easily and the potatoes are golden at the edges.
Garnish with parsley before serving.