refact posts pages