An argument for more housing, not more shelters

I found this article via HN. The title: A Window onto an American Nightmare

This is an extremely important paragraph in the article:
Homelessness afflicts nearly one in five hundred Americans. As a crisis, it’s insidious, because its victims rarely plunge toward the abyss; they slide. Maybe you’ve been couch surfing in between jobs and you overstay your welcome. Maybe you’ve been in Airbnbs while apartment hunting and the search is harder than expected.
But then they say this, which seem ridiculous to me:
San Francisco spends more per capita on homelessness solutions than nearly any other U.S. city—three hundred and thirty million dollars a year. That sum reflects an eighty-five-per-cent increase from 2005 to 2015, when homelessness rose by thirteen per cent. It’s puzzling that so much funding did so little.
It's not puzzling at all when you consider the relationship between housing costs and homelessness. The primary problem here is how crazy expensive San Francisco is. Address that and you won't need to spend so much on "helping the homeless."

Which they more or less address later in the article:
A 2018 study by the University of New Hampshire and Zillow found that homelessness numbers started climbing when median rent exceeded twenty-two per cent of median income, and shot up when it reached thirty-two per cent. In San Francisco, despite its high salaries, the median rent-to-income figure rose above thirty-nine per cent.
This is an extremely important detail:
... add mental illness, drugs, and extreme hygiene into the mix and a shelter can become to sickness what a field of dry brush is to fire.
Abode decided to master-lease apartments, too, and put homeless people in them.

“What we found is, sure enough, if you give people a home and basic services to go along with it, they’ll thrive, at very high rates,” Chicoine said. “We were shocked.” Ninety per cent of people maintained their housing for a year.
The primary cause of homelessness is -- DRUM ROLL PLEASE -- LACK of affordable housing.

I don't know why this is such a HARD concept for Americans to get. The narrative in the US is that homeless people are "all junkies and crazies" and "it's a personal problem" unrelated to the lack of affordable housing.

The data says otherwise.