A conjugated microporous polymer (CMP) combining triazine and bithiophene units in the same framework is synthesized by a facile solvent-free one-pot method and employed as an anode material for lithium/sodium-ion batteries (LIBs/SIBs). It exhibits a large rate capability with a high reversible capacity for LIBs after activation, e.g., 1014 mAh g−1 at 0.1 A g−1 and 486 mAh g−1 at a current density of 5 A g−1 with outstanding cycling stability. Meanwhile, it delivers perfect electrochemical properties for SIBs, featuring high reversible specific capacities of 425/260/156 mAh g−1 at 0.1/1/5 A g−1. Especially, the CMP even outstrips most crystalline covalent organic frameworks (COFs) as SIB anodes at high current density. The lithium and sodium storage mechanisms of the CMP structural unit involve 11-electron redox reactions with four and three-step structure evolutions respectively, as follows from density functional theory calculations. The reported study demonstrates the CMP with redox-active electron donating units via triazine bonding as a promising electrode material for next-generation green sustainable energy storage devices.