If you put a detector to find out which way the particle went through won't that destroy the interference?
You even don't need a detector for destroying interference pattern. Take a look at this experiment. They just put two perpendicular polarizing filters after the slits. So that photon coming out of one slit will be polarized in one way, and photon coming out from second slit - will be polarized differently. So they encoded "which-slit" information into photons passing slits, so called "marker".
This marker will then destroyed interference pattern, with or without photon polarization detector at the end. So conclusion is that not a photon detector destroys interference pattern, but rather a "which-slit" information encoding into traveling photons.
In the aforementioned experiment researchers has entangled a pair of photons. Later one photon from an entangled pair was directed to a slits and another was directed to some measurement device which detected which slit "sibling-photon" has taken. They exploited a quantum entanglement - strange thing in QM when measuring one particle you can say what the other sibling-particle "is doing". So in this experiment you see wave-particle duality at once, but from different photons - the one who passes slits behaves like a wave, and the one who passes into detector behaves like a particle.