From the Shang to Sui (581–618 AD) dynasties, Chinese rulers (both kings and emperors) were referred to by their posthumous names in records and historical texts. Temple names, first used during the reign of Emperor Jing of Han ("r". 157–141 BC), were used exclusively in later records and historical texts when referring to emperors who reigned during the Tang (618–907 AD), Song (960–1279 AD), and Yuan (1271–1368 AD) dynasties. During the Ming (1368–1644 AD) and Qing (1644–1911 AD) dynasties, a single era name was used for each emperor's reign and became the preferred way to refer to Ming and Qing emperors in historical texts.