Algae growth is caused by poor water quality that has too many extra nutrients in it. The direct sunlight will make it a lot easier for the algae to grow. However, if you keep your water of good quality, even with a window next to it, you can limit algae growth. If you can grow macro algae in a refugium that will help because the macros will use up the extra nutrients and stop other algae from growing in ur display. There are also decorative macro algaes that look nice and can go into ur display and will serve the same purpose.
My tank is right next to a window (I had no choice since all rooms in my house have windows except for 1 bathroom and the closets) and I do get some algae growth, but It is fairly minimal because I keep up on my water changes and such.