A flexible bipyridinium ligand with Lewis acidic sites has been introduced into two isomorphous metal-organic frameworks to yield luminescent porous materials with subtriangular pore windows, which exhibit sensitive fluorescent response for ammonia molecules and can be proved at the molecular level by Raman spectroscopy.