# Confused about charge seperation in solar cells

I'm a bit confused about how solar cells work.

My understanding is that there is a p-n junction. A photon is absorbed which creates an electron-hole pair, and the idea is to separate the electron and hole before they recombine in order to produce current.

n-type materials are doped with extra electrons and p-type materials are doped with holes. So why is that in all the diagrams I see, when charge separation occurs, electrons are conducted through the n-type material and holes are conducted through the p-type material? Shouldn't it be the other way round?

-