Phase-coherent caloritronics with ordinary and topological Josephson junctions