Hart didn’t think what was going on inside his home was anyone’s business. Some members of the news media agreed with him. As the former New York Times journalist and columnist Anthony Lewis wrote in May of that year, “When I read about the Miami Herald story on Gary Hart, I felt degraded in my profession. Is that what journalism is about, hiding in a van outside a politician’s home?” In an opinion column, A.M. Rosenthal, who until 1986 had been The Times’s top editor, wrote, “The Herald damaged journalistic self-respect by skulking around Mr. Hart’s house all night.”

It wasn’t the first time that a politician with White House ambitions had made headlines for his sex life. Those of you who can afford tickets to “Hamilton” know Alexander Hamilton had an affair with a 23-year-old woman named Maria Reynolds, to which Hamilton publicly confessed, effectively ending any future presidential run.

The same reporter who wrote about Hamilton’s tryst, James Thomson Callender, also wrote about Thomas Jefferson’s affair with an enslaved woman, Sally Hemings, but Jefferson, already president when the story broke, was re-elected anyway. During the 1884 presidential campaign, it was discovered that Grover Cleveland had had a child out of wedlock with a woman named Maria Halpin 10 years earlier. He still won. But over the next several decades, the dalliances of White House occupants, including John F. Kennedy and Lyndon B. Johnson, were mostly known but unreported.

The Nixon administration changed those calculations. A post-Watergate electorate wanted a trustworthy candidate, both professionally and personally. In 1976, Jimmy Carter famously told voters, “I’ll never lie to you.” When Hart was running for president, the Iran-contra affair was in the news. It wasn’t a sudden shift, but a drift years in the making. And reporters were different, too: Many saw the work of Bob Woodward and Carl Bernstein, who cracked open Watergate, as the new model for investigative journalism.

“The idea that you had to figure out what the character was of a candidate so that you could save the republic was slightly more in vogue than it is today,” said John Dickerson, the co-host of “CBS This Morning.”