In the last two decades, artificial microstructures including metamaterials and photonic crystals have attracted enormous interest because they provide great possibilities for manipulating optical waves. By judiciously modulating their structural parameters, the effective values of the permeability and permittivity can be designed deliberately to realize novel functionalities beyond the capability of natural materials[1–3]. Metamaterials are three-dimensional (3D) artificial nanostructures, which can be designed to manipulate optical waves in a specific dimension with desirable optical functionalities, such as negative refractive index, invisibility cloaks, and chiral media. Metasurfaces as planar metamaterials have paved the way to arbitrarily manipulate the amplitude, polarization, phase, and frequency of optical waves in an effective way[5–8]. They can be widely applied in polarization conversion, beam deflectors, optical sensors, metalenses, structural colors, and nonlinear optics[14,15]. Photonic crystals as periodically arranged optical nanostructures with photonic band structures have become a key platform for studying optical phenomena in periodic structures. The controlling and manipulating of light in photonic crystals is based on the modulation of periodic potential, which is similar to electronic systems[16,17]. The approach to control light in periodic systems exploits photonic band structures that stem from Bragg scattering or localized resonance. The photonic band structure can be designed and tuned conveniently, giving rise to potential applications in subwavelength imaging[19,20], wave transportation, and mimicking quantum effects. Topology that characterizes the quantized global behavior of the wavefunctions on the entire band structure has aroused great interest in photonics.