I have the below line on the very top of all of my public profiles in various wording, which I've been told by experienced recruiters will cut down but not completely eliminate people contacting me about jobs elsewhere, as there are a ton of recruiters that are just plain sloppy and will spam people anyways.
Really you shouldn't have to explain why you don't want to relocate.
*** Please read before sending me messages and connection requests
Please do not send me messages for contracts or employment outside of the Twin Cities of Minnesota area or that cannot be done at least 95% remotely. Also I do not work with out of state agencies or blind connect to IT recruiters that have not performed basic research regarding my skillsets and employment opportunities. Thanks in advance.