Viljandi is a town and municipality in southern Estonia. The town was first mentioned in 1283, upon being granted its town charter by Wilhelm von Endorpe. The town became a member of the Hanseatic League at the beginning of the 14th century, and is o