In an outdoor autonomous navigational context, classic compass sensors such as magnetometers have to deal with unpredictable magnetic disturbances. In this paper, we propose to get inspiration from the insect navigational abilities to design a celestial compass based on linear polarization of ultraviolet (UV) skylight. To compute the solar meridian relative orientation, our 3D-printed celestial compass uses only two pixels created by two UV-light photo-sensors topped with linear polarizers arranged orthogonally to each other, in the same manner that was observed in insects' Dorsal Rim Area ommatidia. The compass was then embedded on our hexapod walking robot called Hexabot. We first tested the UV-polarized light compass to compensate for yaw random disturbances. We then used the compass to maintain Hexabot's heading direction constant in a straightforward task, knowing the robot has important yaw drifts. Experiments under various meteorological conditions provided steady state heading direction errors from 0.3° under clear sky conditions to 1.9° under overcast sky, which suggests interesting precision and reliability to make this optical compass suitable for robotics.