There is no "right" aperture for landscapes (or anything really).
The general advice is to use a smaller aperture for landscapes as the smaller aperture gives you a larger depth of field so more of the landscape is in focus.
If the light levels are low the advice would usually be to use a longer shutter speed, rather than increase the size of the aperture.
However, it's never as clear cut as that. You can calculate the exact depth of field for a given aperture, at a given focal length, at a specific focal distance on a particular camera (the sensor size does affect DoF).
There are a couple of techniques for increasing depth of field. You could try focus stacking (google it as I've never tried it and don't know much about it) and you could try using the hyperfocal distance.
It's also worth having a look at
this thread where this was discussed at quite some length!
Cue Flake for a discussion about optical diffraction!
Edit: I just realised that the thread I linked to was one you started!!