How are stds spread

How is hpv or herpes spread without having sex? Like does it live on towels, or blankets or beds? Or does it have to be skin to skin contact??