Optical absorption control in two-dimensional materials with nanophotonic structures