You get vitamin D from butter, mushrooms, blubber from marine mammals etc.
No the point is not to get sunlight directly in your eyes that will make you blind.
The hat blocks the direct sunlight so you're only getting the reflected sunlight.
And your chest and back are the parts that are able to absorb the most vitamin D from the sun.
Your scalp does not need to be exposed to the sun to absorb vitamin D