I took a few photos this weekend of a mountain range, and the sun was up above them, off to the top right for most of the photos. I was taking these photos (moving the angle around and whatnot) for about 5 minutes in total. Would this damage the sensor, or is it more like "don't aim the camera directly at the sun"?
This will most probably not damage the camera. However if you are taking a long time composing your shots, always having the sun in the frame, the effect of magnification that the lens has can cause damage to the sensor as the temperature would rise. Using a long lens pointed directly at the sun is also dangerous even for shorter periods. Shooting the sunrise or sunset is not a problem.