Rational design of heterostructures is a promising approach to promote the solar-to-chemical energy conversion; thus, the design of individual units in heterostructures via a molecular engineering strategy is particularly important for unleashing the superior performance of heterojunction materials. In this paper, two organic polymers TrTB and TrBB with two different linking units were designed and synthesized from 2,4,6-tris(5-bromothiophen-2-yl)-1,3,5-triazine (M1), 2,4,6-tris(4-bromophenyl)-1,3,5-triazine (M2), and 1,4-phenylene diboronic acid bis(pinacol) ester (M3), serving as candidates for the composite with carbon nitride (g-C3N4, CN). The obtained TrTB/CN and TrBB/CN heterojunctions prepared by physical ball milling methods showed efficient photocatalytic hydrogen evolution activity. TrTB/CN and TrBB/CN with a 20% feeding ratio showed the best hydrogen production rate, in which TrTB/CN-20 and TrBB/CN-20 produced hydrogen at rates of 41.60 and 4.46 mmol g(-1) h(-1) under full light conditions without any cocatalyst, respectively. Additionally, the hydrogen evolution reaction (HER) rates of TrTB/CN-20 and TrBB/CN-20 bare catalysts under visible light illumination (lambda > 420 nm) were 26.83 and 1.74 mmol g(-1) h(-1), respectively. The large difference in the HER rates of the two heterojunctions arises from the small changes in the linking units of the two polymers, and the excellent photocatalytic performance of TrTB/CN is mainly attributed to the enhanced light absorption ability of the thiophene unit and the suppressed recombination of photogenerated charge carriers by the formation of a type II heterojunction. In addition, TrTB/CN-20 has a good photocatalytic stability with an apparent quantum yield of 3.43% at 420 nm. This study provided an idea for the rational design of efficient metal-free-based heterojunction photocatalysts in the cocatalyst-free hydrogen evolution systems.