A highly ordered π-conjugation TP-COF, consisting of pyrene and triphenylene functionalities alternately linked in a mesoporous hexagonal skeleton, is highly luminescent, harvests a wide wavelength range of photons, and allows energy transfer and migration. Furthermore, TP-COF is electrically conductive and capable of repetitive on–off current switching at room temperature.