Extremely large-scale MIMO (XL-MIMO) communication is a promising technology to improve the capacity for future 6G networks. With a very large number of antennas, the near-field property of XL-MIMO systems becomes dominant. Unlike the classical far-field line-of-sight (LoS) channel with rank one, the significantly increased degrees of freedom (DoFs) are available in the near-field LoS channel. However, limited by the small number of radio frequency (RF) chains, the existing hybrid precoding architecture widely used for 5G is not able to utilize the extra DoFs in the near-field region. In this paper, we propose the distance-aware precoding (DAP) scheme to exploit the near-field effect as a new possibility for capacity improvement. Firstly, the DAP architecture is developed, where each RF chain can be flexibly controlled as active or inactive according to the distance-related DoFs. Then, a dedicated selection circuit is inserted to connect phase shifters and RF chains. Moreover, based on the developed DAP architecture, a DAP algorithm is proposed to jointly optimize the number of activated RF chains and precoding matrices to match the increased DoFs in the near-field region. Finally, simulation results verify that, the proposed DAP scheme can efficiently utilize the extra DoFs in the near-field region to improve the capacity.