Login to download the latest version of Mint and your favorite Pepper, purchase additional licenses, or post in the Forum. Don't have an account? Create one!

In Partnership with Media Temple

Mint Forum

How to stop Pages pepper from truncating page titles?

Anarres
Minted
Posted on Feb 14, '07 at 03:21 pm

I have four pages on this website: http://offthesteps.co.nz

Two of them have titles longer than Pages can handle, so when looking at the Pages stats I can’t tell which are which without mousing over them because they’re truncated:

  • Off The Steps - Bed & Breakfast |…
  • Off The Steps - Bed & Breakfast | Photos
  • Off The Steps - Bed & Breakfast | Links
  • Off The Steps - Bed & Breakfast |…

What’s strange is where it truncates them; the Photos and Links titles are still longer than the truncated titles. If it needs to truncate them at all (which is questionable) why does it chop them off at a fixed number of characters from the left, instead of a fixed number of characters from the right (i.e. why doesn’t it just chop off as many characters as it needs to fit)?

In any case, is there any way I can stop it truncating the titles?

Edit the file /mint/app/lib/mint.php/

On line 3344 there is settings for an abbreviation function and you may change the truncate length. Try inputting 80 or 100 instead of 44.

Code:

 function abbr($var, $len = 44, $reverse = false)

Example making the lines longer:

 function abbr($var, $len = 80, $reverse = false)

I also added a str_replace() php command on line 3346 to filter out the global site page title (Off The Steps - Bed & Breakfast in your case) and replace it with a ‘/’. This shortens the page title lengths too.

Let me know if you’d like a specific line of code.

Shaun Inman
Mint/Pepper Developer
Posted on Feb 19, '07 at 04:24 pm

Overriding Page Titles is the recommended way of addressing this problem.

Also worth mentioning is that people using tabbed browsers are seeing truncated page titles as well. I would recommend reversing your page titles. Instead of Site Name / Section Name / Page Title use Page Title / Section Name / Site Name. This will not only improve your experience with Mint but the experience of the visitors on your site.

Anarres
Minted
Posted on Feb 20, '07 at 05:50 pm

Thanks Johnny, that did the trick.

Shaun, the Overriding Page Titles method is for CMSs with a coded variable for titles, but I’m using RapidWeaver and don’t appear to have such a tag. My titles are simply what I’ve chosen to use (I could easily shorten them to whatever I like).

The reason my titles are as they are is because it helps search engine ratings to have such relevant words in the title.

As for the suggestion to reverse my titles, I don’t know.

Do you really think:

Napier, New Zealand | Bed & Breakfast | Off The Steps

would be better than:

Off The Steps | Bed & Breakfast | Napier, New Zealand

Ronald Heft
Third-Party Pepper Developer
Posted on Feb 20, '07 at 08:16 pm

Anarres, you can still use the Overriding Page Titles trick. It’s just mainly suggested for CMSs.

And yes, I would recommend reversing it.

Johnny: I wouldn’t mind that specific line of code to filter out the global site page title.

Around line 3344 edit the following code:

 function abbr($var, $len = 80, $reverse = false) 
 {
    $var = preg_replace('/^http(s)?:\/\/(www\.)?('.str_replace('.', '\.', implode('|', $this->domains)).')?(:\d+)?/', '', $var);

    if (empty($var))

You may add an str_replace() tag around the code as so:

 function abbr($var, $len = 80, $reverse = false) 
 {
    $var = str_replace("Text string to replace", "What to replace it with", preg_replace('/^http(s)?:\/\/(www\.)?('.str_replace('.', '\.', implode('|', $this->domains)).')?(:\d+)?/', '', $var));

    if (empty($var))

For a better understanding, the way str_replace() works is:

str_replace (“text to match”, “replacement string”, “text to apply this to”);

Fehler
Minted
Posted on Mar 10, '07 at 08:23 am

Dear All,

My problem isn’t that Mint tuncates the titles, it doesn’t even record the pages visited in Pages.

We’re running an ad. campaign at present and, as I’ve checked my stats. over the last few days I’ve been surprised to see that the campaign appears to bringing in no traffic at all. I couldn’t see how this was the case as I’d been getting feedback from a number of people who’d been looking at the web pages in question, yet they weren’t appearing on my Mint stats. at all.

Closer inspection today reveals the pages in question are being looked at, but Mint isn’t recording them. I suspect because the page titles are too long for Mint to handle.

The page titles at our site tend to be quite long, of the format:

Fallt Publishing | Artist | Title

On the page we’re trying to track there’s quite a long title:

Fallt Publishing | Fehler + Fairchild Semiconductor | 100 Days [Iraq Conflict 20.05.06 - 27.08.06]

With the title as above, Mint doesn’t record it in the stats. However, if I change the title to:

Fallt Publishing | 100 Days

No problem, Mint records it fine. So clearly there’s an issue with the length of a page title and Mint’s ability to record it to the database. Is there a limit on page title lengths? If so, why is this?

I’ve tried Johnnydanger’s tip above and still no joy. The pages in question don’t even get recorded.

Frustrated!

Fehler
Minted
Posted on Mar 10, '07 at 08:36 am

If I change the page title from this:

Fehler + Fairchild Semiconductor | 100 Days [Iraq Conflict 20.05.06 - 27.08.06]

to this:

Fehler + Fairchild Semiconductor » 100 Days [Iraq Conflict 20.05.06 - 27.08.06]

i.e. replace the second ‘|’ with a ‘»’ it works fine. Seems odd that the ‘|’ is causing this problem. Does this mean I need to alter all the page titles in the site? I hope not, there are 100s of pages.

Shaun Inman
Mint/Pepper Developer
Posted on May 21, '08 at 09:39 am

Fehler, no. You do not have the change the page titles. You have mod_security installed which is preventing Mint from receiving the record request with extended characters like » in them. You should disable mod_security in your /mint/ directory.

You must be logged in to reply. Login above or create an account