We consider a Bose-Hubbard trimer, i.e. an ultracold Bose gas populating three quantum states. The latter can be either different sites of a triple-well potential or three internal states of the atoms. The bosons can tunnel between different states with variable tunnelling strength between two of them. This will allow us to study; i) different geometrical configurations, i.e. from a closed triangle to three aligned wells and ii) a triangular configuration with a $pi$-phase, i.e. by setting one of the tunnellings negative. By solving the corresponding three-site Bose-Hubbard Hamiltonian we obtain the ground state of the system as a function of the trap topology. We characterise the different ground states by means of the coherence and entanglement properties. For small repulsive interactions, fragmented condensates are found for the $pi$-phase case. These are found to be robust against small variations of the tunnelling in the small interaction regime. A low-energy effective many-body Hamiltonian restricted to the degenerate manifold provides a compelling description of the $pi$-phase degeneration and explains the low-energy spectrum as excitations of discrete semifluxon states.