I am used to seeing examples in calculus of variations with functionals acting on curves in manifolds, i.e. $$\mathcal{L}(\gamma) = \int_0^1 L(t, \gamma(t), \dot{\gamma}(t) ) dt$$ for $\gamma : [0,1] \to N$ a smooth curve in a smooth manifold $N$, and $L: \mathbb{R} \times N \times TN \to \mathbb{R}$ (I'm not fully sure of the domain of $L$ in this case, actually). $L$ is often said to be time dependent.
I am interested in the natural generalization where the time dependency is changed to that of another manifold $M$, i.e. for $f : M \to N$, we have something that may look like $$ \mathcal{L}(f) = \int_M L (p, f(p), df_p) dVol. $$ (Again I am unsure of the domain of $L$ in this case, or if $df_p$ even appears in the expression.)
Is this the correct formulation for this generalization? If so, how would one define the functional derivative of $\mathcal{L}$, if it even exists, in order to, say, work with the Euler-Lagrange equations? I'm having trouble finding anything clear about the subject in the online literature.
The specific example I am looking at is of the form $$\mathcal{L}(f) = \int_M X(h \circ f) dVol, $$ where $X$ is a vector field over $M$ and $h$ is a smooth real function over $N$. Perhaps using this example to illustrate my above questions would be more helpful.