Inhaltsverzeichnis

WvdS.DokuWiki.OpenGraph Plugin

Plugin: wvdsopengraph
Version: 1.0.0
Namespace: lib/plugins/wvdsopengraph/
Author: Wolfgang van der Stille zeljko.petrusic@outlook.de
License: GPL 2


Definition

The wvdsopengraph plugin generates Open Graph and Twitter Card meta tags for optimal display when sharing on social media. It supports multilingual content and page-specific overrides.

Use Cases


Syntax

<og>
title = Page Title
description = Description
image = :wiki:logo.png
type = article
</og>

Parameters

Parameter Type Default Description
title string (page title) Title for social media
description string (tagline) Description (max. 160 characters)
image string (default image) DokuWiki media path
type string article Open Graph type

Multilingual Values

All values support the pipe format:

<og>
title = de:Kryptographie|en:Cryptography|sl:Kriptografija
description = de:Einführung|en:Introduction|sl:Uvod
</og>

The plugin automatically detects the language from the namespace path.


Automatic Tags

Without an

====== My Project ====== Page content… </code> ==== Example 2: Multilingual ==== <code>

</code> —- ===== Generated HTML Tags ===== <code html> <!– Open Graph –> <meta property=„og:title“ content=„OpenSSL Documentation“> <meta property=„og:description“ content=„Comprehensive guide“> <meta property=„og:image“ content=„https://example.com/lib/exe/fetch.php?media=crypto:openssl-banner.png“> <meta property=„og:url“ content=„https://example.com/doku.php?id=en:crypto:openssl“> <meta property=„og:site_name“ content=„Knowledge Base“> <meta property=„og:type“ content=„article“> <!– Twitter Card –> <meta name=„twitter:card“ content=„summary_large_image“> <meta name=„twitter:title“ content=„OpenSSL Documentation“> <meta name=„twitter:description“ content=„Comprehensive guide“> <meta name=„twitter:image“ content=„https://example.com/lib/exe/fetch.php?media=crypto:openssl-banner.png“> </code> —- ===== Configuration ===== ==== Admin Settings ==== Via Admin → Configuration → wvdsopengraph: ^ Setting ^ Type ^ Default ^ Description ^ | defaultDescription | Text | (tagline) | Default description (multilingual) | | defaultImage | Text | (empty) | Default image media ID | | twitterSite | Text | (empty) | Twitter @username for twitter:site | | enableTwitterCards | On/Off | On | Generate Twitter Card tags | —- ===== How It Works ===== ==== Processing Pipeline ==== <code> 1. Page Parsing └── Searches for

block at page start 2. Parameter Extraction └── Parses key = value pairs └── Detects de:X|en:Y format 3. Language Detection └── Determines language from namespace └── Extracts matching value 4. Meta Tag Generation └── Creates og:* and twitter:* tags └── Inserts into <head> </code> —- ===== Error Handling ===== ^ Scenario ^ Behavior ^ | No <og> block | Uses automatic values | | Image not found | Uses defaultImage | | Invalid language | Fallback to first value | | Empty value | Tag is not generated | —- ===== Best Practices ===== * Description: Maximum 160 characters * Title: Maximum 60 characters * Image: Minimum 1200×630 pixels for optimal display * Format: JPEG or PNG for images —- ===== Version History ===== ^ Version ^ Date ^ Changes ^ | 1.0.0 | 2025-01-06 | Initial release | —- ===== See Also ===== * WvdS.DokuWiki.Lang Plugin - Multilingual translations * WvdS.DokuWiki.Image Plugin - Image optimization * Open Graph Protocol * Twitter Cards —- ===== Technical Reference ===== ==== Class: syntax_plugin_wvdsopengraph ==== File: lib/plugins/wvdsopengraph/syntax.php ^ Method ^ Description ^ | getType() | Returns substition | | getSort() | Returns 50 (early) | | handle($match, …) | Parses <og> block | | render($mode, …) | No output (meta tags only) | ==== Class: action_plugin_wvdsopengraph ==== File: lib/plugins/wvdsopengraph/action.php ^ Method ^ Description ^ | register() | Registers TPL_METAHEADER_OUTPUT event | | addMetaTags()'' | Inserts meta tags into header |