You are here: start » en » Internal Documentation » DokuWiki extensions (WvdS) » Preview when shared

Preview when shared

Open Graph gives every wiki page the values social networks and search engines build their preview from: title, description, image. Without them the receiving side decides what to show — and usually decides badly.

Get started

Common tasks

What you want For whom Where it is
How do I give a page its own preview image? Authors Reference: the block
How do I write title and description in several languages? Authors Reference: multilingual values
Why does the network show something other than expected? Authors Reference: where values come from
How do I set defaults for the whole wiki? Operators Reference: defaults
How do I check whether the preview images are good enough? Operators Reference: image check
How does my package contribute its own values? Developers Reference: extension point

How a value comes about

Defaults          Page                Contributing packages
(settings)        (<og> block)        (event)
     │                 │                    │
     └────────► stage 2 ◄──────────► stage 3
                       │
                       ▼
          whatever is not empty is delivered
                       │
                       ▼
        og:title  og:description  og:image  og:url
        og:type   og:site_name    twitter:*

Later values win, empty ones never overwrite. An empty value produces no tag — a delivered empty tag is read by a consumer as a promise that this page has no description, instead of looking for one itself.

What the package does

  • Six values: title, description, image, URL, type, site name.
  • Two equivalent notations for the block on the page.
  • Multilingual values in one field, separated by language code.
  • Defaults for the whole wiki, overridable per page.
  • A check of the preview images for size and aspect ratio.
  • An event through which other packages contribute their own values.

Core concepts

Each of the six values passes through three stages: the package defaults, the page block, and the contributions of other packages. What is delivered in the end is whatever is not empty. The description is the only value whose default is itself a chain — first the page abstract, then the default text, then the wiki tagline. The abstract comes first because it alone describes the page being shared. In full: Reference: where values come from.

Administration

The administration screen lives at ?do=admin&page=wkopengraph. It shows the defaults with their effect, offers a page block as a form, and checks the preview images. See Reference: administration screen.

When something does not work

This package has no diagnostic pages of its own yet. The known special cases are described in Reference: behaviour in special cases.

For developers

en/wiki/dwe/wkopengraph.txt · Last modified: by rollout