Over the past few decades the direct assembly of optical nanomaterials into ordered mesoporous frameworks has proved to be a considerable challenge. Here we propose the incorporation of ultrasmall (sub5nm) graphitic pencil nanodots into ordered mesoporous frameworks for the fabrication of optoelectronic materials. The nanodots, which were prepared from typical commercial graphite pencils by an electrochemical tailoring process, combine properties such as uniform size (∼3 nm), excellent dispersibility and high photoconversion efficiency (∼27%). These nanodots were incorporated into a variety of ordered mesoporous frameworks (TiO2, silica, carbon and silicacarbon materials) by coassembly, driven by hydrogen bonding, with the frameworks' precursors. The resulting materials showed a high degree of ordering, and a sharp increase in their optical performance (for example, photocurrent density). We envisage that the largescale synthesis of ultrasmall carbon nanodots and their incorporation into ordered mesoporous frameworks may facilitate the preparation of materials with a variety of optical properties.