Computational methods are used to show that graphene nanoribbons bind sodium (Na) and calcium (Ca) more strongly than graphene sheets. The binding strength is further enhanced by functionalizing the edge of the nanoribbon with oxygen-containing groups. Strengthening of the binding of these metal atoms to graphitic materials is important for applications including metal-ion batteries. Our results are obtained using density functional theory calculations of the binding of sodium and calcium to hydrogen, hydroxyl, carbonyl, and carboxyl groups at the edge of zigzag and armchair nanoribbons. Both hydrogen passivation and hydroxyl functionalization result in moderate binding of Na and Ca with binding energies varying from -1.0 to -1.9 eV for the nanoribbons considered. An increase in binding compared to graphene does not just occur at the edge, but extends across the nanoribbon. Furthermore, carbonyl and carboxyl groups bound both metal atoms more strongly, with binding energies between -1.6 and -3.1 eV. Increasing the number of these groups at the edge increases the binding strength of the metal adatoms. When there is a high number of oxygen-containing groups at the edge, the effect of the oxygen-containing groups is also evident away from the edge of the nanoribbon for sodium and calcium. It is demonstrated that this is at least partly due to the change in the electronic structure spanning the entire width of the nanoribbons considered.