Tailored metal-containing ionic liquids generate porous carbon suitable for selective dye sorption and Fenton chemistry by thermal cyclotrimerization of terminal alkynes.