Covalent organic frameworks (COFs) have attracted widespread attention for gas storage, separation, catalysis, and sensors applications. We report a simple, inexpensive, and abundant aromatic nitrile 1,4-dicyanobenzene (1,4-DCB) as a lithium-ion battery anode material through the synthesis of a DCB triazine-based covalent organic framework (DCB-COF) under ionic thermal conditions. An investigation of the lithium storage mechanism of the active groups in the DCB-COF by in-situ Fourier-transform infrared spectroscopy, ex-situ X-ray photoelectron spectroscopy, and density functional theory calculations demonstrates that DCB-COF had a high initial capacity of 2100 mAh g−1, and good structural and cycling stability. This work provides an effective strategy for the subsequent fabrication of novel COF electrode materials.