I would generalize this function to adding a <link> element with a "name" attribute (in your case e.g. "goodle_directios_json" and an additional attribute fname.