Adding conditional appending to document head