In this paper, we consider the semilinear elliptic equation \(\begin{aligned} \varepsilon ^2\Delta u+V(x)(|u-1|^p-1)=0,~u>0,~u\in H^1(\mathbb {R}^2), \end{aligned}\) where \(\varepsilon >0\) is a small parameter, the power \(p>1\) , V is a smooth positive function. Under the appropriate gap condition, the problem admits a solution \(u_\varepsilon \) concentrating along a closed curve \(\Gamma \) , which is stationary and nondegenerate with respect to the weighted length functional \(\int _\Gamma V^{\frac{1}{2}}\) .