HUGO

Setting og:image for homepage

I am using the academic theme and want to set og:image for my homepage, which can be set via $featured_image in the site_head.html partial.

I tried creating a content/home/featured.png to live next to content/home/index.md and thought it would get found via the following, but $featured_image is nil and .Resources is resources.Resources(nil).

Where should I place a featured image for the homepage?

Please reach out to the theme author(s):

I could not get your question completely but I hope what you want to do is set a separate og:image for the home page only. This can be done as follows, in your head partial you can include this (untested):

{{ if .IsHome }}
{{ $ogimg := "images/photo.jpg" }}
  <meta property="og:image" content="{{ $ogimg | absURL }}" />
{{ end }}

Then place photo.jpg in folder static/images/

This was resolved with:
https://github.com/wowchemy/wowchemy-hugo-themes/discussions/2476