HTML Entities in Title

Dear all,

I came across the issue that one of my journals (for whatever reason) has HTML entities in the title (e.g. Die afrikanischen Arten der Gattungsgruppe 'Amytta' Karsch (Saltatoria: Tettigoniidae, Meconeminae). | Beiträge zur Entomologie = Contributions to Entomology) that are shown on the article page.
However, when looking on the issue summary, where the title is shown too, the entities are correlty converted (escaped? unescaped? I am never sure which is which).

I hoped that piping in the template the localized title through the strip_unsage_html funtion would help, but it did not. What is happening in the issue summary that does not apply on the article page? What wizardry is that!?

Thanks for any help!

Best Regards,

Adrian

Hi Adrian,

The title appears to be shown in two different ways.

In templates/frontend/objects/article_details.tpl it is:

    <h1 class="page_title">
            {$article->getLocalizedTitle()|escape}
    </h1>

Where as in templates/frontend/objects/article_summary.tpl

it is:

{$article->getLocalizedTitle()|strip_unsafe_html}

The latter is used on the issue table of contents, and appears to be correct for your journal.

If you make the change in the first template, does this solve your issue? You’d want to swap escape for strip_unsafe_html, not use both.

Cheers,
Jason

Yes! I already tried swapping the escape for the strip_unsafe_html. This did not do the trick. I also cleared the template cache to be sure, but it did not work either… :frowning:

Hi @GrazingScientist,

This is filed as an issue here: Inconsistent HTML display in article titles · Issue #2564 · pkp/pkp-lib · GitHub

In the meantime, I recommend using proper UTF-8 rather than HTML entities in titles, and avoiding the use of HTML for formatting (e.g. italics).

Regards,
Alec Smecher
Public Knowledge Project Team

Damn! But thanks for telling me! :slight_smile: