Metalloporphyrin (Fe, Co)-based conjugated porous polymer frameworks are new high-surface-area porous materials consisting of an extended conjugated skeleton and inherent mesopores. These porous polymers have exhibited great potential in gas sorption/separation and catalysis. Given their unique carbon-rich skeleton with inherent metal–nitrogen coordination, herein we demonstrate novel high-performance self-supported oxygen reduction electrocatalysts obtained through the template-free pyrolysis of cobalt porphyrin-based conjugated mesoporous polymer (CoP-CMP) frameworks. The resulting cobalt-nitrogen doped carbons possess unique features, such as a ribbon-shaped morphology, a high surface area, and a mesoporous structure (4–20 nm). Further, they contain uniformly distributed cobalt nanoparticles embedded in a nitrogen-enriched carbon matrix. As a result, these cobalt–nitrogen-doped porous carbons display an outstanding catalytic performance toward the ORR in alkaline media, such as a more-positive half-wave potential (−0.18 V vs. AgCl/Ag), a high and stable limiting current ( ∼ 4.62 mA cm −2 ), excellent stability ( ∼ 96.7% retention after 1000 cycles), and almost a four-electron transfer pathway, all of which are superior to commercial 20 wt% platinum–carbon (Pt/C) catalysts. Moreover, these novel catalysts can mediate the ORR process in acidic media with excellent activity in terms of half-wave potential ( ∼ 0.64 V vs. RHE), limiting current ( ∼ 4.84 mA cm −2 ), high stability ( ∼ 94.5% retention after 1000 cycles), and high electron transfer number ( ∼ 3.94) comparable with Pt/C.