How can I stop a water hammer on the toilet cistern?
Sounds like either a loose washer in the shut off valve or the fill valve. Do this , turn off water supply at the shut off then flush toilet to empty tank. Once tank is empty turn water back on at shut off valve. If start getting a hammering sound before you get the water turned all the way back on, it’s in the shut off and it should be replaced. If you do not get that sound until the tank is all most full you should replace the fill valve. A “Fluidmaster 400-A” is a good choice for the fill valve.