Counterion effects in liquid crystal templating of nanostructured CdS