MarkupMetadata by Fokke

ProcessWire 3.x markup module for rendering meta tags in HTML document head section.

Markup Metadata

ProcessWire 3.x markup module for rendering meta tags in HTML document head section. Note that this module is not full-blown SEO solution, but rather a simple tool for rendering meta tags based on module configuration. Adding custom meta tags is also supported.

Built-in meta tags

The following meta tags are supported out-of-the-box:

  • Document title consisting of page title and site name
  • Character set
  • Canonical
  • Viewport
  • Description
  • Keywords
  • Hreflang tags
  • Open Graph
    • og:title
    • og:site_name
    • og:type
    • og:url
    • og:description
    • og:image
    • og:image:width
    • og:image:height

  • Twitter meta tags
    • twitter:card
    • twitter:site
    • twitter:creator
    • twitter:title
    • twitter:description
    • twitter:image

  • Facebook meta tags
    • fb:app_id


Install using Composer

composer require fokke/markup-metadata

Manual installation

Extract module files to site/modules/MarkupMetadata directory.


// Initialize module instance
$metadata = $modules->get('MarkupMetadata');

// Optionally set your custom meta tags, or overwrite module configuration before rendering...

// Render metadata
echo $metadata->render();

Public methods

setMeta($tag, $attrs, $content)

Set custom meta tag.

  • string $tag HTML tag name to use
  • array|null $attrs Optional array of HTML tag attributes in the following format: 'name' => 'value'
  • string|null $content Optional inner content for the element. Most likely this will be used only for <title> tag.
$metadata->setMeta('meta', [
  'name' => 'author',
  'content' => 'Jerry Cotton',
// <meta name="author" content="Jerry Cotton">


Render all meta tags



After you have installed the module, check module configuration page for available options. If you wish, all these options can be set or overwritten in code like this:

// Add this line before rendering
$metadata->site_name = 'My custom site name';

// Set multiple properties
  'page_title' => 'My custom title',
  'site_name' => 'My custom site name',
  'description' => 'My custom description',


Type: string

This URL will be used in canonical and og:url meta tags. If unset, page URL will be dynamically built of base_url, current page URL, and URL segments (if defined).


Type: string, Default: ''

Used as a base for building the current page URL.


Type: string, Default: 'utf-8'

Used in charset meta tag.


Type: string, Default: 'width=device-width, initial-scale=1.0'

Used in viewport meta tag.


Type: string

Used in keywords meta tag. If unset, keywords of the current page will be used. See keywords_selector.


Type: string, Default: 'keywords'

This selector will be used to get current page keywords using $page->get() method.


Type: string

By default document title will be built of page_title, document_title_separator and site_name. You can overwrite this property if you want a fully customized document title.


Type: string

Value will be used in title, og:title and twitter:title meta tags. If unset, title of the current page will be used. See page_title_selector.


Type: string

This selector will be used to get current page title using $page->get() method.


Type: string, Default: '-'

Value will be used to separate page title and site name in document title.


Type: string, Default: 'Site name'

Value will be added to the document title after page title. It will also be used in og:site_name meta tag.


Type: string

Used in description, og:description, and twitter:description meta tags. If unset, description of the current page will be used. See description_selector.


Type: string, Default: 'summary'

This selector will be used to get current page description using $page->get() method.


Type: integer, Default: '160'

Description will be truncated to the specified number of characters.


Type: string, Default: 'word'

Select truncate mode to use with $sanitizer->truncate() method.


Type: \ProcessWire\Pageimage

Used in og:image and twitter:image meta tags. By default the module will attempt to get image from the current page by using image_selector. This image will be resized to the dimensions defined by image_width and image_height properties.


Type: string, default: 'image'

This selector will be used to get current page image using $page->get() method.


Type: integer, Default: 1200

Image will be resized to specified width.


Type: integer, Default: 630

Image will be resized to specified height.


Type: boolean, Default: false

Toggle rendering of hreflang tags on/off. To enable, set value to true. In order to render hreflang tags, the following requirements must be met:

  1. Your site has at least two languages set up
  2. LanguageSupportPageNames module is installed
  3. Field defined in property hreflang_code_field exists and your language template includes that field.
  4. Language code field is populated in every language page. If the language code field is empty, the hreflang tag will not be rendered for that language.


Type: string, Default: 'languageCode'

This field name will be used define language code for every language page.


Type: boolean, Default: true

Toggle rendering of Open Graph tags on/off. To disable, set value to false.


Type: string, Default: 'website'

Open Graph type of the page/resource. Used in og:type meta tag.


Type: boolean, Default: false

Toggle rendering of Twitter tags on/off. To enable, set value to true.


Type: string, Default: 'summary_large_image'

Twitter card type, which can be one of summary, summary_large_image, app, or player. Used in twitter:card meta tag.


Type: string, Default: null

Twitter user name. Used in twitter:site meta tag.


Type: string, Default: null

Twitter user name. Used in twitter:creator meta tag.


Type: boolean, Default: false

Toggle rendering of Facebook tags on/off. To enable, set value to true.


Type: string, Default: null

Facebook application ID. Used in fb:app_id meta tag.

Install and use modules at your own risk. Always have a site and database backup before installing new modules.

Twitter updates

  • ProcessWire 3.0.192 (dev branch) contains 11 issue fixes and 5 pull requests, over 20 commits— More
    7 January 2022
  • ProcessWire 3.0.191 core updates: updates to the installer and the profile exporter module— More
    24 December 2021
  • This week ProcessWire went on a diet, trimming the core size from 15.5 MB down to 7.5 MB by moving optional site profiles into their own GitHub repos— More
    17 December 2021

Latest news

  • ProcessWire Weekly #401
    In the 401st issue of ProcessWire Weekly we'll cover the latest core updates, check out a brand new module called Lister Native Date Format, and more. Read on! / 15 January 2022
  • ProcessWire 3.0.190 core updates
    ProcessWire 3.0.190 has 15 commits relative to 3.0.189 and contains a mixture of issue resolutions and feature additions. This post covers them all, in addition to updates for the PageAutosave and ProFields Table modules.
    Blog / 3 December 2021
  • Subscribe to weekly ProcessWire news

“ProcessWire is like a breath of fresh air. So powerful yet simple to build with and customise, and web editors love it too.” —Margaret Chatwin, Web developer