Graphene nanoribbons (GNRs), nanometer-wide strips of graphene, have garnered significant attention due to their tunable electronic and magnetic properties arising from quantum confinement. A promising approach to manipulate their electronic characteristics involves substituting carbon with heteroatoms, such as nitrogen, with different effects predicted depending on their position. In a recent publication, we present the extension of the edges of 7-atom-wide armchair graphene nanoribbons (7-AGNRs) with pyridine rings, achieved on a Au(111) surface via on-surface synthesis. High-resolution structural characterization confirms the targeted structure, showcasing the pre-dominant formation of carbon-nitrogen (C-N) bonds (over 90% of the units) during growth. This favored bond formation pathway is elucidated and confirmed through density functional theory (DFT) simulations. Furthermore, an analysis of the electronic properties reveals a reduction of the band gap of the GNR, accompanied by the presence of nitrogen-localized states. Our results underscore the successful formation of C-N bonds on the metal surface, providing insights for designing new GNRs that incorporate substitutional nitrogen atoms to precisely control their electronic properties. The record contains data that support the findings described in the publication.