Original: Lang and von Harbou, who were married, wrote the screenplay in, and published a novelization in 1926, before the film was released.
Simplified: The screenplay was written in 1924 by Lang and his wife, Thea von Harbou, and novelized by von Harbou in 1926.