Heroes and Clan Castle donated troops ability to select type of defense. Give the option to defend all or to defend the Town Hall only. It would trigger once enemy troops are in range of the town hall.
The town hall currently does not have a range ring so it would require one to be implemented. I would suggest the range ring on the town hall to be just a little bigger than an archers max attack range.