Set up to share ox-hugo blog posts on social media
While preparing to share this post on LinkedIn, I noticed something’s missing.
The preview didn’t show an image or description.
Apparently there’s a special so-called Open Graph protocol that solves this problem.
From the protocol’s introduction:
The Open Graph protocol enables any web page to become a
rich object in a social graph. For instance, this is used on Facebook to allow
any web page to have the same functionality as any other object on Facebook.
I got it working in ox-hugo by:
- Adding opengraph = true in the [params] section of hugo’s config.toml
- Adding this org property for the image: EXPORT_HUGO_CUSTOM_FRONT_MATTER
- Adding this org block for description: begin_description
Long story short. Here’s the applied change for the beforementioned post. Shortened but still raw:
git show 2ce4aa9
...
:ID: d8a908ad-6672-4931-b3ea-0b595a53e272
+ :EXPORT_HUGO_CUSTOM_FRONT_MATTER: :images '(/ox-hugo/2021-08-07_19-11-35_screenshot.png)
:END:
+#+begin_description
+Create an image in blender using python. In the most minimal way we'll add a sphere and render the image.
+#+end_description
+
...