I know there are many questions on this but I ask a proof verification and a clarification. I am trying to prove that given $X$ topological space,
$X$ is contractible if and only if it is a deformation retract.
The if part is clear to me (it is just a stronger requirement than asking the identity is nullhomotopic)
The only if part: by definition of contractible, $X \sim \{x_0\}$, which holds if and only if the identity map $id_X$ is homotopic to the constant map $\text{const }x_{0}$. Then I take the following retraction: $r:X \rightarrow \{x_0\}$ given by $r = \text{const }x_{0}$.
Denoting $i$ the inclusion of $\{x_0\}$ into $X$, now $r \circ i = id_{\{x_0\}}$ and $i \circ r = \text{const }x_{0} \sim id_X$ by the fact $X$ is contractible.
Nevertheless, here people show a space which is contractible but does not deformation retract to any point. What am I missing?