We demonstrate the self-assembling and size-selective synthesis of uniform and highly dispersed Ni or NiO nanoparticles with diameters below 12 nm embedded in ordered mesoporous carbon or polymer frameworks. Self-assembly is induced by evaporation of the solvent from a mixture of metal-containing liquid crystalline (LC) mesophases of triblock copolymer and transition metal nitrate hydrate, and the carbon source is low-polymerized phenolic resol. Characterization by XRD, N2 sorption isotherms, TEM, HRSEM, ICP-AES, TG, and XPS techniques has indicated an ordered 2D hexagonal mesostructure, high surface areas between 524 and 721 m2 g−1, uniform pore sizes of about 4.0 nm, large pore volumes ranging from 0.34 to 0.58 cm3 g−1, and metal contents ranging from 0.6 to 10.0 wt %. There is a high degree of dispersion, and a small size of nanoparticles throughout the whole framework, without aggregation outside of the pores due to the confinement effect of the mesoporous ordered matrix. The mesoporous solids show excellent adsorption properties for dyes and permit an easy magnetic separation procedure. This method is expected to be applicable to other mesoporous transition metal(oxide)-containing carbon catalysts.