You are here: start » en » Internal Documentation » DokuWiki extensions (WvdS) » Preview when shared » Quickstart: set a page's preview card

Quickstart: set a page's preview card

The shortest way from “the plugin is installed” to “a shared page shows the title, the text and the image you chose”. Three steps, about ten minutes.

Prerequisites

  • wkopengraph is installed and enabled in the Extension Manager.
  • You are signed in as superuser — the defaults screen is administrators only.
  • A preview image, at least 600 × 315 pixels.
  • For the final check on the open internet: an address reachable from outside. A consumer cannot read a page it cannot reach. Without that you check the HTML source, which is enough.

Step 1: see what the page already emits

Open a page and view its HTML source. In the <head> there are already og: and twitter: entries, resolved from the page title and the installation's defaults.

That is the starting point — not a blank sheet.

Step 2: set the defaults

Admin → Social preview (Open Graph), directly /doku.php?do=admin&page=wkopengraph.

Field What goes in it
Site name The site's name as it should read in a preview.
Default image An absolute address, beginning with https://.
Default description The text for pages without one of their own.

The card below the fields shows immediately what the values produce.

The default image must be absolute. A wiki-relative address is silently useless: the consuming service fetches the image from its server, where a wiki-relative path means nothing.

Save. That raises the floor for every page at once.

Step 3: control one page explicitly

Put an <og> block on the page:

<og>
title: Delivery scheduling
description: How routes are planned, and which constraints apply.
image: :wiki:preview:scheduling.png
</og>

The leading colon on the image marks it as a media id rather than a finished address; it is resolved to an absolute one for you.

The same block can be edited under Maintain page markup on the administration screen. That is an ordinary page change with a revision — reversible at any time.

Check the result

Reload the page and read the HTML source again:

  • <meta property="og:title" …> carries your title.
  • The image address is absolute.
  • A property you left empty is not emitted at all. That is intended: an empty content would assert “this page has no description” and stop the consumer looking for one itself. Omitting the tag lets it.
Consuming services cache aggressively. A change not showing up on the open internet straight away is the normal case and not a fault — the HTML source is the reliable check.

Next step

  • wki18n — title, description and image per language out of one block: title: en:Delivery scheduling|de:Tourenplanung.
  • wkopengraph (German) — the package page: every property, the twitterCard shape, the image minimums.
en/wiki/dwe/wkopengraph/quickstart.txt · Last modified: by 0.0.0.0