1D porous g-C3N4 nanorods were synthesized using chitosan as a template, offering a large surface area and enhanced visible light absorption. These nanorods exhibited a remarkable 8.3-fold increase in H2 generation rate (26.6 μmol h-1) compared to bulk g-C3N4.