How to set open graph image for a specific page?

I call a partial from the appropriate template for the specific page.

This code is old though, and in need of refactoring to work with the latest hugo.