  With the examples of the C $K$-edge in graphite and the B $K$-edge in
hexagonal BN, we demonstrate the impact of vibrational coupling and lattice
distortions on the X-ray absorption near-edge structure (XANES) in 2D layered
materials. Theoretical XANES spectra are obtained by solving the Bethe-Salpeter
equation of many-body perturbation theory, including excitonic effects through
the correlated motion of core-hole and excited electron. We show that
accounting for zero-point motion is important for the interpretation and
understanding of the measured X-ray absorption fine structure in both
materials, in particular for describing the $\sigma^*$-peak structure.
