This paper studies a cold-start problem of inferring new edges between vertices with no demonstrated edges but vertex content by learning vertex-based similarity metrics. Existing metric learning methods for link prediction fail to consider communities which can be observed in real-world social networks. Because communities imply the existence of local homogeneities, learning a global similarity metric is not appropriate. In this paper, we thus learn community-specific similarity metrics by proposing a community-weighted formulation of metric learning model. To better illustrate the community-weighted formulation, we instantiate it in two models, which are community-weighted ranking (CWR) model and community-weighted probability (CWP) model. Experiments on three real-world networks show that community-specific similarity metrics are meaningful and that both models perform better than those leaning global metrics in terms of prediction accuracy.