BEIJING — The advertisement for sperm donors was exacting.

No bald men. No hereditary diseases like color blindness. And in case there were any doubts, the sperm bank at Peking University Third Hospital clarified: Only men with an abiding love for the “socialist motherland” need apply.

President Xi Jinping’s drive to restore the Communist Party’s place at the center of everyday life in China has brought socialist banners to city streets, nationalistic rap music to the airwaves and patriotic heroes to movie theaters. Now Mr. Xi has inspired a new test of party loyalty — reproduction.

The ad placed by the hospital sperm bank, which has circulated widely on social media in recent days, listed support for the Communist Party and Mr. Xi as its top requirements for potential donors.

“He must have good ideological thoughts,” the ad said by way of describing ideal donors, “love the socialist motherland and support the leadership of the Chinese Communist Party.”