Photocatalytic hydrogen production in pure water without oxygen precipitation is highly effective owing to the minimal efficiency of water oxidation for oxygen generation and the complexity of the reaction, yet it presents a significant hurdle. Here, we report the preparation of crystalline carbon nitride (CCN) homojunction-anchored Co atoms using the molten salt and reflux method. Our findings indicate that elevated temperature during ionothermal synthesis promotes the phase transition of poly(heptazine) imides (PHI) to poly(triazine) imides (PTI), and the homogeneous junction formed in this process promotes exciton dissociation as well as carrier migration through the built-in electric field formed by the semi-coherent interface. During water splitting, the Co atom on CCN can modulate the generation of H