The immobilization of porphyrin molecules within porous materials using cost-effective methods holds significant importance. Herein an in situ synthetic strategy involves the condensation of imidazole aldehyde and pyrrole to create 5,10,15,20-tetra(1H-imidazol-5yl)porphyrin, followed by a cross-coupling reaction to effectively integrate porphyrin units into a porous polymer (RSS-2). RSS-2 exhibited heightened permanent porosity, with a surface area measuring 655 m 2 / g, noteworthy nanoporosity at a pore size of 6 Å, and enhanced thermal stability, evidenced by a decomposition temperature of 430 °C. Moreover, RSS-2 exhibited a high adsorption capacity of 79 cm 3 .g −1 , remarkable CO 2 affinity (Q st 38 KJ.mol −1 ), and a CO 2 /N 2 Henry's selectivity of 255.