Refactor recent posts list as javascript