Nanoporous Co-doped Zn1-xCdxS were facilely fabricated via adopting ZIFs as templates, and Cd(NO3)2 and thiourea as precursors. The highly porous microstructure and uniform Co-doping of the photocatalyst afford a high H2-production rate (45.2 and 422.2 times larger than those of Zn0.5Cd0.5S and CdS), providing an effective way for the development of high performance nanoporous photocatalysts.