Metal nanostructures in optoelectronic devices