A chemically stable and thermally stable luminescent Cd(II)-based metal–organic framework (MOF), [Cd3(DBPT)2(H2O)4]·5H2O (1), featuring an open Lewis basic triazolyl active site in the host, was successfully assembled by using the multifunctional ligand of 3-(3,5-dicarboxylphenyl)-5-(4-carboxylphenyl)-1-H-1,2,4-triazole (H3DBPT) to bridge hexanuclear {Cd6} clusters. The host material exhibits ligand-based photoluminescence and solvent-dependent fluorescent intensities, which could selectively detect nitroaromatic compounds (NACs) of 2,4,6-trinitrophenol (TNP) and 4-nitroaniline (4-NA). The most striking property of 1 is the remarkable sensitivity and selectivity toward TNP and 4-NA even in the presence of other NACs of nitrobenzene (NB), which can be attributed to a photoinduced electron transfer mechanism and resonance energy transfer mechanism. Their photoluminescence quenching could be detected at very low concentrations of 1.14 and 0.70 ppm, respectively, and the maximum quenching efficiencies were fo...