Cleaning cloth diapers

Alexis • Mom to Rocky Bruce IV 3/1/19 and Lindsey 1/5/21

So I just started using cloth diapers with my 12 week old and all the diapers he pooped in I rinsed before throwing in the wash. Well when I pulled them out they were stained yellowish. I used free and gentle detergent. How do I clean them so they don’t stain?