Writing a coordinate formula for $|df|^2$ I need to write a coordinate formula for $|df|^2$, where $f$ is a smooth function. This is in the context of Riemannian Geometry. 
I know that $|X|^2$ can be written as $\langle X, X\rangle$, which is $g_{ij}X^iX^j$. However, what about $|df|^2$? Is this equal to $\langle \nabla f,\nabla f\rangle=g_{ij}(\nabla f)^i(\nabla f)^j$?
 A: The Riemannian metric induces an isomorphism $g$ between each tangent and cotangent space, so you get an inner product on the cotangent space by pulling back the inner product on the tangent space:
$$ \langle \theta_1, \theta_2\rangle_{T^*M} = \langle g(\theta), g(\theta)\rangle_{TM} $$
As in coordinates $g(\theta)^{i} = g^{ij}\theta_j$ and $\langle X, Y\rangle_{TM} = g_{ij}X^iY^j$ we have that 
$$ \langle \theta_1,\theta_2\rangle_{T^*M} = g_{ij}g^{ik}\theta_kg^{jl}\theta_l = g^{kl}\theta_k\theta_l $$
That is, multiply by the inverse of the local coordinate expression of the Riemannian metric.
I leave it to you to compute $|df|^2$.
A: I think, that Neal's answer is all correct and valid, but I would like to add my perspective on this issue, for the sake of completeness, and for further references. 
By definition, for any connection $\nabla$ on a (smooth) manifold  and any smooth function $f: M \to \mathbb{R}$,
$$
\nabla f := \textrm{d}f
$$
Using the abstract index notation, we can write $\nabla_i f$ for $\nabla f$ to indicate that $\nabla f$ is a $1$-form on $M$. For a vector (field) $X$ we would write $X^i$.
A metric tensor $g$ is denoted as $g_{i j}$, whereas its inverse is written as $g^{i j}$. For instance, $\langle X, Y \rangle = g_{i j} X^i Y^j$
We can extend the inner product $\langle \cdot, \cdot \rangle$ from vector fields to any tensor field by using the metric $g_{i j}$ to contract vector (contravariant) indices, and the inverse metric $g^{i j}$ to contract co-vector (covariant) indices.
For instance, 
$$
|df|^2 = \langle \nabla f, \nabla f \rangle = g^{ij} ( \nabla_i f) \nabla_j f \tag{*}
$$
so that you were almost there.
Notice, however, that (*)
trivially holds for any (not only the Riemannian, aka Levi-Civita!) connection $\nabla$.
