The Lagrangian hydrodynamics algorithm using staggered mesh is one of the most important algorithms for engineering design and science computing. Some questions need to use the conservative scheme. Shashkov gave the idea how to get conservation with a material. He defined the conservative scheme to be a compatible algorithm. When we perform a numerical simulation with two or more materials, we should use sliding line or contact-impact algorithm. In this case, the Wilkins algorithm is used mostly. But this algorithm is not conservative. This paper presents a conservative method for sliding line based on the compatible Lagrangian hydrodynamics algorithm and Wilkins sliding algorithm. The conservation of total energy can be got by the local modification through the idea of contact force and contact work. This method can ensure the symmetric property and conservative property, and improve the numerical accuracy. In this paper, we give the detail in how to design the conservative sliding algorithm and how to impose the slave's edge artificial viscosity. We also gave some numerical simulations to prove that our scheme is right and useful.