corrected gallery folder look-up so that it works with text and markdown posts