Function in boundary condition, defined on boundary only

I have previously posted a recipe on how to project the FacetNormal to an appropriate volume function space, see: How to plot normal unit vector of faces in a 2D mesh? - #2 by dokken
This function would only give you a normal on the boundary, 0 at all other dofs.