Lithium–sulfur battery is a promising energy storage device because of its high theoretical specific energy density, low cost, and environmental friendliness. Here, we prepared nitrogen-doped hierarchically porous carbon nanosheets (N-PCNS) by NaCl salt-assisted one-pot pyrolysis strategy, using NaCl, glucose, and melamine as template, carbon and nitrogen as source. Using N-PCNS hosted sulfur composite material (N-PCNS/S) as the cathode material of the lithium–sulfur battery, the first specific discharge capacity at 0.2 C is 956.7 mA h g−1, and the reversible capacity after 100 cycles is 625.9 mA h g−1, with the capacity loss of 0.34% per cycle. At the high rate of 0.5 C, the specific capacity of the first discharge is still 717.3 mA h g−1. This study provides a simple and feasible strategy for the preparation of cathode materials for lithium–sulfur batteries.