Jump to content

Markup Metadata


Fokke
 Share

Recommended Posts

ProcessWire 3.x markup module for rendering meta tags in HTML document head section. Note that this module is not a 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

The full documentation with configurable options can be found here: https://github.com/Fokke-/MarkupMetadata

 

Requirements:

  • ProcessWire>=3.0.0
  • PHP >=7.1

Installation using Composer

composer require fokke/markup-metadata

Manual installation

  • Like 8
Link to comment
Share on other sites

Hi,

Thank you for your module.

Just a suggestion : because I don't have a specific "description" field for the meta tag, I rely on an "about" field which is a CKEditor. Because of a <a> tag within it, there was an issue rendering one of the pages. So on my local copy I used $sanitizer->truncate()  on line 134:

$this->description = $this->description ?? $this->sanitizer->truncate($this->page->get($this->description_selector), 160, ['type' => 'sentence']);

Maybe this could be a valuable addition ?

  • Like 1
Link to comment
Share on other sites

23 minutes ago, monollonom said:

Hi,

Thank you for your module.

Just a suggestion : because I don't have a specific "description" field for the meta tag, I rely on an "about" field which is a CKEditor. Because of a <a> tag within it, there was an issue rendering one of the pages. So on my local copy I used $sanitizer->truncate()  on line 134:

$this->description = $this->description ?? $this->sanitizer->truncate($this->page->get($this->description_selector), 160, ['type' => 'sentence']);

Maybe this could be a valuable addition ?

Hello there!

Thank you for your suggestion. This sounds like a nice addition, and it will be added to the next version. maxLength will be configurable setting.

  • Like 3
  • Thanks 1
Link to comment
Share on other sites

New version of the module is now released.

  • Truncate description using $sanitizer->truncate() method
  • Added properties: description_max_length and description_truncate_mode
  • Due to the usage of truncate method, the module now requires PW >=3.0.101
  • Image added using API will be resized
  • Validate image object before resizing it
  • Added API notes for all fields in module configuration
  • Documentation fixes

Download here: https://github.com/Fokke-/MarkupMetadata/releases/tag/1.1.2

  • Like 5
Link to comment
Share on other sites

  • 8 months later...

v. 1.2.0 is now released

  • Twitter tags will be rendered by default
  • Added support for image alternative text using custom fields in images
  • Added support for inheriting image from parent pages (including home page)
  • Added support for fallback page for image. 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. You can use this to define default image for all pages.
  • Fixed crash when passing an empty Pageimages object as an image
  • Fixed crash when supplying an invalid image width or height

Note that module now requires PW 3.0.142 or later, as custom fields for image and file fields were introduced in that version.

  • Like 6
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...