Emerging covalent organic frameworks (COFs) have received great attention for their unique features, but the limited building blocks restrict their structural diversity and performance exploration. Reticular chemistry provides guidance for the structural expansion and performance regulation of COFs. Herein, we constructed two novel two-dimensional (2D) COFs functionalized with cyclopentadienyl cobalt, denoted as UPC-COF-1 and UPC-COF-2, via [4+2] imine condensation with diamine building blocks of different length. Theoretical simulations combined with experimental results reveal that UPC-COF-1 with shorter building blocks, narrower pore sizes, and stronger host-guest interactions has better C