PHPackages                             fokke/markup-metadata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. fokke/markup-metadata

ActivePw-module[Utility &amp; Helpers](/categories/utility)

fokke/markup-metadata
=====================

Render meta tags in ProcessWire sites.

1.3.0(9mo ago)81.2k2[2 issues](https://github.com/Fokke-/MarkupMetadata/issues)MPL-2.0PHPPHP &gt;=7.1

Since Dec 24Pushed 9mo ago2 watchersCompare

[ Source](https://github.com/Fokke-/MarkupMetadata)[ Packagist](https://packagist.org/packages/fokke/markup-metadata)[ RSS](/packages/fokke-markup-metadata/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (1)Versions (13)Used By (0)

Markup Metadata
===============

[](#markup-metadata)

ProcessWire 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
------------------

[](#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
    - og:image:alt
- Twitter meta tags
    - twitter:card
    - twitter:site
    - twitter:creator
    - twitter:title
    - twitter:description
    - twitter:image
    - twitter:image:alt
- Facebook meta tags
    - fb:app\_id

Installation
------------

[](#installation)

### Install using Composer

[](#install-using-composer)

```
composer require fokke/markup-metadata
```

### Manual installation

[](#manual-installation)

Extract module files to `site/modules/MarkupMetadata` directory.

Usage
-----

[](#usage)

```
// 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
--------------

[](#public-methods)

### setMeta($tag, $attrs, $content)

[](#setmetatag-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 `` tag.

```
$metadata->setMeta('meta', [
  'name' => 'author',
  'content' => 'Jerry Cotton',
]);
//
```

### render()

[](#render)

Render all meta tags

```
$metadata->render();
```

Configuration
-------------

[](#configuration)

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
$metadata->setArray([
  'page_title' => 'My custom title',
  'site_name' => 'My custom site name',
  'description' => 'My custom description',
]);
```

### page\_url

[](#page_url)

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](#baseurl), current page URL, and URL segments (if defined).

### base\_url

[](#base_url)

Type: `string`, Default: `'https://domain.com'`

Used as a base for building the current page URL.

### charset

[](#charset)

Type: `string`, Default: `'utf-8'`

Used in `charset` meta tag.

### viewport

[](#viewport)

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

Used in `viewport` meta tag.

### keywords

[](#keywords)

Type: `string`

Used in `keywords` meta tag. If unset, keywords of the current page will be used. See [keywords\_selector](#keywordsselector).

### keywords\_selector

[](#keywords_selector)

Type: `string`, Default: `'keywords'`

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

### document\_title

[](#document_title)

Type: `string`

By default document title will be built of [page\_title](#pagetitle), [document\_title\_separator](#documenttitleseparator) and [site\_name](#sitename). You can overwrite this property if you want a fully customized document title.

### page\_title

[](#page_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](#pagetitleselector).

### page\_title\_selector

[](#page_title_selector)

Type: `string`

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

### document\_title\_separator

[](#document_title_separator)

Type: `string`, Default: `'-'`

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

### site\_name

[](#site_name)

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.

### description

[](#description)

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](#descriptionselector).

### description\_selector

[](#description_selector)

Type: `string`, Default: `'summary'`

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

### description\_max\_length

[](#description_max_length)

Type: `integer`, Default: `'160'`

Description will be truncated to the specified number of characters.

### description\_truncate\_mode

[](#description_truncate_mode)

Type: `string`, Default: `'word'`

Select truncate mode to use with [`$sanitizer->truncate()`](https://processwire.com/api/ref/sanitizer/truncate/) method.

### image

[](#image)

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](#imageselector). This image will be resized to the dimensions defined by [image\_width](#imagewidth) and [image\_height](#imageheight) properties.

### image\_selector

[](#image_selector)

Type: `string`, default: `'image'`

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

### image\_width

[](#image_width)

Type: `integer`, Default: `1200`

Image will be resized to specified width.

### image\_height

[](#image_height)

Type: `integer`, Default: `630`

Image will be resized to specified height.

### image\_alt\_field

[](#image_alt_field)

Type: `string`, Default: `alt`

The value of this field will be used as an alternative text of the image. Enable custom fields for your image field and specify the field name.

### image\_inherit

[](#image_inherit)

Type: `boolean`, Default: `false`

If the image cannot be found from the current page, the module will try to find the image from the nearest parent page (including home page).

### image\_fallback\_page

[](#image_fallback_page)

Type: `\ProcessWire\Page`, Default: `null`

If the image cannot be found from the current page (and possibly enabled inheritance fails), the module will try to find the image from the given page. Use this to define default image for all pages. The selector defined above will be used to find the image.

### render\_hreflang

[](#render_hreflang)

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](#hreflangcodefield) 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.

### hreflang\_code\_field

[](#hreflang_code_field)

Type: `string`, Default: `'languageCode'`

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

### render\_og

[](#render_og)

Type: `boolean`, Default: `true`

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

### og\_type

[](#og_type)

Type: `string`, Default: `'website'`

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

### render\_twitter

[](#render_twitter)

Type: `boolean`, Default: `false`

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

### twitter\_card

[](#twitter_card)

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.

### twitter\_site

[](#twitter_site)

Type: `string`, Default: `null`

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

### twitter\_creator

[](#twitter_creator)

Type: `string`, Default: `null`

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

### render\_facebook

[](#render_facebook)

Type: `boolean`, Default: `false`

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

### facebook\_app\_id

[](#facebook_app_id)

Type: `string`, Default: `null`

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

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance51

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~171 days

Recently: every ~263 days

Total

11

Last Release

294d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/09ffa4017d1a1f5c66ae68411be6db5647be59adf642c71d6dcfc49efde3d1bf?d=identicon)[fokke](/maintainers/fokke)

---

Top Contributors

[![Fokke-](https://avatars.githubusercontent.com/u/3109666?v=4)](https://github.com/Fokke- "Fokke- (49 commits)")[![teppokoivula](https://avatars.githubusercontent.com/u/1252021?v=4)](https://github.com/teppokoivula "teppokoivula (5 commits)")

---

Tags

metadataprocesswire-modules

### Embed Badge

![Health badge](/badges/fokke-markup-metadata/health.svg)

```
[![Health](https://phpackages.com/badges/fokke-markup-metadata/health.svg)](https://phpackages.com/packages/fokke-markup-metadata)
```

###  Alternatives

[adrianbj/tracy-debugger

The ultimate debugging and development tool for ProcessWire.

935.5k](/packages/adrianbj-tracy-debugger)[apeisa/process-redirects

151.1k](/packages/apeisa-process-redirects)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
