Technical SEO

"Title too long" on 28,000 pages? Fix it once, in the template

28,000 "title too long" warnings are usually one line of template code. How to find it, write a title formula with a length budget, and ship the fix in Next.js, WordPress or Laravel.

By SEOFix TeamPublished Updated
2,223 words · 10 min readMarkdown
"Title too long" on 28,000 pages? Fix it once, in the template

If a site audit reports "title too long" on 28,000 pages, you don't have 28,000 problems. You have one title formula in one template, and the fix is to change that formula once: put the words that tell pages apart first, give the title a length budget, and drop the brand suffix or the least important field when a title runs over. This guide shows how to find the template from the URLs, how to write the formula, and working code for Next.js, WordPress and Laravel, plus how to verify the fix on a sample before you wait for a full re-crawl.

What Google actually says about title length

Google doesn't publish a character limit. Its title link documentation says: "While there's no limit on how long a <title> element can be, the title link is truncated in Google Search results as needed, typically to fit the device width" (Google Search Central, title links).

Two things follow from that sentence.

  1. A long title is not an error in Google's eyes. Google sets no limit, so a 75-character title isn't breaking a rule. The cost is that the end of the title gets cut off in the result, and the end is usually where templates put the most specific information (location, company, price).
  2. Truncation is about width, not characters. "Fit the device width" means pixels. A title of capital Ws runs out of room long before a title of lowercase i's of the same length. A 60-character rule is a proxy for that. SEOFix measures the width instead and flags TITLE_TOO_LONG when a title renders wider than about 600 pixels (On-page checks). Treat 60 characters as a budget that keeps you safe for typical Latin text, not as a line Google draws.

Google may also not show your title at all. Its title link docs list the sources it uses to build the title link: the <title> element, the main visual title, headings, og:title, prominent text, anchor text, links pointing to the page and WebSite structured data (title links). When Google changed its title system in 2021, it said HTML title elements were then "used around 87% of the time, rather than around 80% before", and named the patterns that make it look elsewhere: half-empty, obsolete, inaccurate and "micro-boilerplate" titles (Google Search Central Blog, September 2021). That post describes half-empty titles as something that "often occurs when large sites use templates to craft titles", which is the exact situation this article is about.

Google's best practices for title elements are short: be descriptive and concise, avoid keyword stuffing, avoid "repeated or boilerplate text", and brand the title concisely at the beginning or end "separated from the rest of the text with a delimiter" (title links).

Why 28,000 warnings are one bug

Programmatic pages get their titles from a formula, something like:

{job title} - {company} - {city}, {country} | {Brand} - {slogan}

Every page rendered by that template inherits the formula. If the fixed part (separators, brand, slogan) is 35 characters, any job title longer than 25 characters pushes the page over 60. On a job board, that's most of them. Hence the 28,000 count.

For scale: on jobxdubai.com, the job board we use as our own test site, the jobs sitemap alone lists 30,729 URLs, and our full crawl of the site on 7 October 2026 fetched 37,218 pages. Nearly all of those job pages come from one route, /jobs/[slug]. Whatever that route puts in <title>, 30,000 pages get.

So stop reading the issue list page by page. Group it by template.

Find the template that generates the titles

You need two things: which URL pattern the affected pages share, and which file renders that pattern.

Group the URLs. Export the affected URLs from your audit tool and collapse the dynamic parts of each path. A practical rule, the same one SEOFix uses (Fixing by template): keep the first path segment, replace all-digit segments with [id], and replace segments that contain a hyphen or a digit, or are longer than 24 characters, with [slug]. /jobs/senior-accountant-dubai becomes /jobs/[slug]. If one pattern holds almost all of the affected pages, the template is the cause. SEOFix marks an issue "Template-wide" when it's on at least 80% of a template's pages (with at least 5 pages), which is a useful threshold even if you're grouping by hand.

Map the pattern to a file.

StackWhere /jobs/[slug] titles usually come from
Next.js App Routerapp/jobs/[slug]/page.tsx (generateMetadata), plus title.template in a parent layout.tsx
Next.js Pages Routerpages/jobs/[slug].tsx, inside <Head> or a shared SEO component
WordPressThe SEO plugin's title template for the post type (Yoast, Rank Math), or the theme via document_title_parts
LaravelThe Blade view for the job page (@section('title')) and the layout's <title>

Check where the suffix comes from. In Next.js, a brand suffix often lives in the root layout as title.template: '%s | Brand', not in the page. In WordPress, the separator and site name come from the SEO plugin's settings. Fixing the page formula without noticing the suffix is an easy way to end up still at 70 characters.

Write a title formula with a length budget

Before touching code, decide the formula on paper.

  1. List the fields in priority order. For a job page: job title, city, company, brand. The first field is what the searcher typed. The last is what you can afford to lose.
  2. Put the distinguishing part first. Truncation cuts the end. If two pages differ only in the last 15 characters, both look identical in the result once Google trims them, which is also the "boilerplate" pattern Google warns about.
  3. Set a budget. 60 characters for Latin-script titles.
  4. Write fallbacks, not one string. Try the full version first, then drop the brand, then drop the company, then fall back to the job title alone, cut at a word boundary if even that's too long.

For a job board that looks like this:

Attempt                     Example                                                  Chars
Full                        Accountant in Dubai at Emaar | Example Jobs                43
Without brand               Senior Financial Accountant in Dubai at Emirates Group     54
Without company             Senior Accountant (IFRS, Big Four) in Abu Dhabi            47
Title only, cut at a word   Senior Accountant – IFRS and Big Four Audit Experience     54

Short titles keep the brand. Long ones lose it first. Nothing gets cut mid-word.

Do the same for meta descriptions while you're in the template. DUPLICATE_META_DESCRIPTION and META_DESCRIPTION_TOO_LONG on a programmatic site usually come from the same place, and adding the company and location to the description template both differentiates the pages and gives the snippet something specific to say.

The fix in Next.js (App Router, generateMetadata)

Put the formula in one function so every route uses the same rules:

// lib/seo/fit-title.ts
const MAX_TITLE = 60;

/** Returns the first candidate that fits, else the last one cut at a word boundary. */
export function fitTitle(candidates: string[], max = MAX_TITLE): string {
  const clean = candidates
    .map((c) => c.replace(/\s+/g, " ").trim())
    .filter(Boolean);

  for (const c of clean) {
    if (c.length <= max) return c;
  }
  return cutAtWord(clean[clean.length - 1] ?? "", max);
}

function cutAtWord(text: string, max: number): string {
  if (text.length <= max) return text;
  const cut = text.slice(0, max + 1);
  const lastSpace = cut.lastIndexOf(" ");
  const head = lastSpace > max * 0.6 ? cut.slice(0, lastSpace) : text.slice(0, max);
  return head.replace(/[\s|,:;–—-]+$/, ""); // no dangling separator
}

Then use it in the page's generateMetadata. In current Next.js, params is a promise you have to await (Next.js docs, generateMetadata):

// app/jobs/[slug]/page.tsx
import type { Metadata } from "next";
import { fitTitle } from "@/lib/seo/fit-title";
import { getJob } from "@/lib/jobs";

const BRAND = "Example Jobs";

type Props = { params: Promise<{ slug: string }> };

export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { slug } = await params;
  const job = await getJob(slug);

  const title = fitTitle([
    `${job.title} in ${job.city} at ${job.company} | ${BRAND}`,
    `${job.title} in ${job.city} at ${job.company}`,
    `${job.title} in ${job.city}`,
    job.title,
  ]);

  return {
    // absolute: skip the layout's "%s | Brand" template, because the budget already decided on the brand
    title: { absolute: title },
    description: `${job.title} at ${job.company} in ${job.city}. ${job.salaryText ?? ""}`.trim(),
  };
}

Two details that matter here:

  • title.absolute. If your root layout sets title: { template: '%s | Example Jobs' }, Next.js appends that suffix to every child title. title.absolute "can be used to provide a title that ignores title.template set in parent segments" (generateMetadata docs). Without it, your carefully budgeted 58-character title becomes 73 characters in the HTML.
  • No double fetch. getJob is called in both generateMetadata and the page. The Next.js docs note that fetch requests in generateMetadata are memoized across generateMetadata, layouts, pages and Server Components, and that React cache can be used when fetch isn't available (generateMetadata docs). If getJob hits your database directly, wrap it in cache().

The fix in WordPress (theme, Yoast, Rank Math)

Where the title comes from depends on what's active. Fix it at the layer that actually prints the <title>.

A shared helper, multibyte-safe:

// functions.php or a small mu-plugin
function example_fit_title( array $candidates, int $max = 60 ): string {
    $candidates = array_values( array_filter( array_map(
        fn( $c ) => trim( preg_replace( '/\s+/u', ' ', (string) $c ) ),
        $candidates
    ) ) );
    foreach ( $candidates as $c ) {
        if ( mb_strlen( $c ) <= $max ) {
            return $c;
        }
    }
    $last = end( $candidates ) ?: '';
    $cut  = mb_substr( $last, 0, $max + 1 );
    $pos  = mb_strrpos( $cut, ' ' );
    $head = ( $pos !== false && $pos > $max * 0.6 ) ? mb_substr( $cut, 0, $pos ) : mb_substr( $last, 0, $max );
    return preg_replace( '/[\s|,:;–—-]+$/u', '', $head );
}

function example_job_title_candidates( int $post_id ): array {
    $title   = get_the_title( $post_id );
    $city    = get_post_meta( $post_id, 'job_city', true );
    $company = get_post_meta( $post_id, 'job_company', true );
    $brand   = get_bloginfo( 'name' );
    return [
        "$title in $city at $company | $brand",
        "$title in $city at $company",
        "$title in $city",
        $title,
    ];
}

No SEO plugin (theme with title-tag support). WordPress builds the title from parts you can filter with document_title_parts. The array has title, page, tagline and site keys (WordPress developer reference). Replace title and remove site so WordPress doesn't append the site name after your budget is spent:

add_filter( 'document_title_parts', function ( array $parts ): array {
    if ( ! is_singular( 'job_listing' ) ) {
        return $parts;
    }
    $parts['title'] = example_fit_title( example_job_title_candidates( get_queried_object_id() ) );
    unset( $parts['site'], $parts['tagline'] );
    return $parts;
} );

Yoast SEO. Yoast prints its own title and exposes the wpseo_title filter, which receives the title string and a presentation object (Yoast developer docs):

add_filter( 'wpseo_title', function ( $title, $presentation ) {
    if ( ! is_singular( 'job_listing' ) ) {
        return $title;
    }
    return example_fit_title( example_job_title_candidates( get_queried_object_id() ) );
}, 10, 2 );

Rank Math. The equivalent filter is rank_math/frontend/title (Rank Math filters and hooks):

add_filter( 'rank_math/frontend/title', function ( $title ) {
    if ( ! is_singular( 'job_listing' ) ) {
        return $title;
    }
    return example_fit_title( example_job_title_candidates( get_queried_object_id() ) );
} );

Before writing code for either plugin, check whether the plugin's title template for the post type (in its settings) already explains the length. If that template appends the site name and a tagline after every title, removing the tagline in settings can fix most pages without any PHP. Use the filter when you need the fallback logic.

The fix in Laravel (Blade)

Blade layouts usually print the title with @yield, and the page view fills it with @section('title', ...) (Laravel Blade docs). Keep the brand decision out of the layout, so the layout prints exactly what the page computed:

{{-- resources/views/layouts/app.blade.php --}}
<title>@yield('title', config('app.name'))</title>

Compute the title once, in a small helper or the model:

// app/Support/SeoTitle.php
namespace App\Support;

use Illuminate\Support\Str;

class SeoTitle
{
    public static function fit(array $candidates, int $max = 60): string
    {
        $candidates = array_values(array_filter(array_map(
            fn ($c) => Str::squish((string) $c),
            $candidates,
        )));

        foreach ($candidates as $c) {
            if (mb_strwidth($c) <= $max) {
                return $c;
            }
        }

        // preserveWords cuts at a word boundary; '' means no "..." appended
        return Str::limit(end($candidates) ?: '', $max, '', preserveWords: true);
    }
}
{{-- resources/views/jobs/show.blade.php --}}
@extends('layouts.app')

@section('title', \App\Support\SeoTitle::fit([
    "{$job->title} in {$job->city} at {$job->company} | " . config('app.name'),
    "{$job->title} in {$job->city} at {$job->company}",
    "{$job->title} in {$job->city}",
    $job->title,
]))

Str::limit takes a preserveWords argument that truncates "to the nearest complete word boundary", and its third argument replaces the default ... ending (Laravel strings docs). Pass '' as the end, or the three dots push the title back over budget. Also, Str::limit measures with mb_strwidth (we checked the Laravel 12 source), which counts fullwidth characters such as CJK as 2 and everything else as 1 (PHP manual, mb_strwidth). That's a closer match to rendered width than a plain character count for East Asian titles, and it's why the helper above uses mb_strwidth for the check too.

Blade's {{ }} statements go through PHP's htmlspecialchars (Blade docs), so a job title containing & or < is safe in <title>. Don't switch to {!! !!} to "fix" an &amp; you see in the source. That's correct HTML.

Edge cases worth handling

  • Non-Latin scripts. For Arabic, CJK or Cyrillic pages, 60 characters can render wider or narrower than 60 Latin characters. If you run the same template in several languages, consider a per-locale budget rather than one global number.
  • Pixel width. No character count matches Google's truncation exactly, because Google truncates "to fit the device width" (title links). A title full of capitals and wide letters can be cut at 55 characters. Put the distinguishing words first and this stops mattering much.
  • Google rewrites anyway. Even a perfect title can be replaced by an H1 or anchor text. Make sure the H1 on the page says the same thing as the title's first part, so whichever Google picks reads well.
  • Pagination and filters. /jobs?page=2 pages often get the same title as page 1 plus " - Page 2" appended after the brand. Put the page number before the brand, or handle these URLs with a canonical or noindex instead of optimising their titles.
  • Empty fields. If company is empty, "Accountant in Dubai at | Brand" slips through. Filter empty parts out before building candidates, or build each candidate only when its fields exist.

Verify the fix before waiting for a full crawl

  1. Check rendered HTML, not your editor. Fetch a few real URLs and read the title the server returns: bash for u in /jobs/senior-accountant-dubai /jobs/sales-manager-abu-dhabi /jobs/hr-officer-sharjah; do curl -s "https://example.com$u" | grep -o '<title>[^<]*</title>' | sed 's/<[^>]*>//g' | awk '{ print length($0) " " $0 }' done Pick samples deliberately: the longest job title you have, one with an empty company, one in another language.
  2. Check for a second <title>. Adding a title in a page while a layout, plugin or head manager still adds one produces two. SEOFix reports that as MULTIPLE_TITLE_TAGS. grep -c '<title' on the raw HTML should print 1.
  3. Recheck the affected sample, then the whole site. In SEOFix, Verify fix re-fetches up to 200 of the task's URLs (the ones with the most Search Console clicks first) and marks the TITLE_TOO_LONG task fixed when they all pass, usually within seconds. The next full audit confirms the rest of the template.
  4. Watch the search side over weeks, not days. Google picks up new titles as it recrawls, on its own schedule. Compare click-through rate on the template's pages in Search Console 28 days before and after the deploy.

FAQ

Is a title over 60 characters bad for rankings? Google says there's no limit on title length; long titles get truncated in results (title links). The practical cost is that the end of the title is hidden, so put the important words first.

Should I add "..." when I shorten a title? No. Three dots spend three characters of your budget and tell the searcher nothing. Cut at a word boundary and end on a complete word.

Should every title include the brand? Google suggests branding concisely at the start or end with a delimiter (title links). On long programmatic titles, the brand is the cheapest thing to drop. Keep it where it fits.

My audit tool still shows the warning after deploying. Why? Usually caching (CDN, ISR, full-page cache) is serving old HTML, or the layout still appends a suffix. Check the raw HTML with curl before rechecking.

If you'd rather have a coding agent make this change, our walkthrough of the audit, fix and verify loop with Claude Code walks through the same kind of template fix. SEOFix groups every issue by URL template and gives your coding agent one task per template, and its fix tasks come with the sample URLs and a recheck. Run a free 500-page audit to see your issues grouped by template.

ShareXLinkedIn