BEIJING — Newly married in San Francisco, two men with matching red ties held hands and smiled broadly as they bounded out of City Hall on a recent sunny day.

Though a common enough scene in the Bay Area, the marriage ceremony for this couple was notable for many Chinese people seeing the news: One of the men was Hanscom Smith, the United States consul general in Shanghai. Photographs of his marriage, posted Tuesday on the official Chinese microblog account of the United States consul general, generated interest in China, which does not allow same-sex marriage.

Mr. Smith married Lu Yingzong, or Eric Lu, who is from Taipei, Taiwan, an island that is independently governed but that the Chinese Communist Party claims it rules.

One Chinese Internet user by the name of Daniel Chen Dandan posted an image of a beating heart on a microblog, writing, “Respect any type of love.”