SEO field Text Width module

This module is calculating width of text in the fields you can choose on the configuration page.

SEO Text Width 11.0.3

Author: Leftfield. Original repository.

Editor


  • Yellow, green and red width indicators below each SEO title/description input.
  • Final width includes the configured title suffix.
  • One statistics row shows width, guidance and Unicode character count. Entered values are included in the same row only when they differ from the final text.
  • Two or more consecutive spaces produce a short bold warning. Single leading/trailing spaces do not trigger it. No cleanup button and no automatic changes to saved content.
  • Empty SEO fields show their source text in the same language.
  • Fill from source copies the source into an empty SEO field for editing; it never replaces a non-empty manual value.
  • Missing SEO translations are listed with links to the native ProcessWire language tabs.
  • Source changes, paste, undo/redo, TinyMCE changes and AJAX-loaded inputs update the indicators.
  • No Search preview, Page checks, Content inspection, SEO Audit, AI or remote services.

Setup


  1. Select the SEO title and meta description fields under SEO fields.
  2. Set width thresholds under Width guidance.
  3. Select a Title source, usually title, and optionally a Description source, usually a summary or introduction. Rich-text sources become plain text; descriptions are not automatically shortened.
  4. Set the site name, fallback title pattern and suffix.
  5. On multilingual sites, enable separate rules for each language where wording or thresholds differ.
  6. Select templates under Templates with their own SEO rules, save, then configure their field mappings, sources and language rules.

Manual SEO titles override the fallback pattern. The suffix applies to both manual and generated titles. A suffix is separated from the title by one space; do not also add it in the manual field or template.

Examples:

  • News: pattern {title}, suffix | {site_name}.
  • Property: pattern {property_type}, {location} — {area} m², suffix optional.
  • Description: choose an existing summary field, translated where available.

Tokens support existing scalar text/number fields on the page, including zero. {title} means the configured title source, and {site_name} means the configured site name. All tokens in a pattern must have values; an incomplete pattern produces a warning rather than a partial title. Missing suffix values omit that entire suffix.

Language behavior


Settings inherit global defaults, then global language rules, template rules, and finally that template's language overrides. A checked language override may deliberately have an empty suffix/site name.

Multilingual page fields are read with explicit language values: a missing translation never silently uses default-language text. A single-language field is intentionally shared across languages. Install the standard ProcessWire LanguageSupport/LanguageSupportFields modules and use multilingual SEO/source field types for separate translations.

All module interface labels and messages use ProcessWire translation functions. Page text, source text, title patterns, suffixes, site names and thresholds can differ by language.

Frontend integration — required for matching output


Replace the existing title and description tags in your shared head template with:

<?= $modules->get('SeoTextWidth')->renderMeta($page) ?>

This emits escaped title/description HTML once, using the current user's ProcessWire language (including the current frontend language). It leaves all other head tags alone. Do not keep your old title/description tags alongside it.

For an explicit language:

<?= $modules->get('SeoTextWidth')->renderMeta($page, 'en') ?>

For custom output, $modules->get('SeoTextWidth')->resolve($page, $language) returns unescaped title and description results with text, base, sourceText, origin, missing. Escape text for its output context. The helper does not apply field textformatters or scan existing head HTML.

Without this integration, the editor shows the configured result, not a claim about your template's actual output.

Whitespace


ProcessWire InputfieldText normally trims the ends (unless noTrim is enabled); FieldtypeText does not automatically collapse internal double spaces. The module preserves the input and shows its actual width, including repeated/trailing spaces. The final metadata helper collapses whitespace to single spaces and trims the ends. Both counters therefore have a clear purpose.

Pixel widths remain editorial guidance, not fixed search-engine limits.

Upgrade and tests


Copy all module files, refresh modules and open SEO Text Width. Existing field and threshold settings remain supported. The old ProcessSeoAudit companion is uninstalled on upgrade if still installed; its old file can then be removed.

The ProcessWire integration test uses unsaved fixtures and does not save pages, configuration or languages.

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