You can check the value of .Site.BaseURL, and then not call the twitter, Instagram stuff if the value is "localhost".
Also there’s an open feature request:
But even without that request getting implemented, it’s pretty easy to check for the BaseURL value.
Related: How I prevent Disqus from showing up on Hugo server