[Publish] Support openGraph / twitter metadata in <head> for embeds

Currently, Obsidian Publish sets the meta data for a website entirely itself and in ways that discourage public use of Publish.

Use case or problem

Compare this embed:

With this Obsidian Publish page’s embed:

The favicon is broken, which I think is just an unrelated bug, but even though that page has images on it, none are used for the embed because of Obsidian’s JavaScript-based rendering approach.

Proposed solution

Generate basic static pages with the actual page content (i.e. without requiring JavaScript to show anything) and add some automatically generated embed metadata for opengraph and twitter embeds, potentially overridable via YAML frontmatter:

<meta property="og:title" content="{{ note_title }}" />
<meta property="twitter:title" content="{{ note_title }}" />
<meta name="description" content="{{ first_text_line_in_note }}" />
<meta property="og:description" content="{{ first_text_line_in_note }}" />
<meta property="og:image" content="{{ first_image_or_configurable_in_yaml }}" />
<meta property="twitter:image" content="{{ first_image_or_configurable_in_yaml }}" />
<meta property="og:url" content="{{ published_url }}" />
<meta property="og:site_name" content="{{ site_name }}" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="{{ user_locale }}" />
<meta property="article:published_time" content="{{ zettelkasten_date }}" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="{{ yaml_specified }}" />
1 Like

I’m really looking for this!

I’m using obsidian like a blog and I’m missing that feature so much!