How to make italics in article title in OJS 3

I agree with @jmacgreg: we need a solution please that allows italics tags but strips them out for metadata. I’ve just upgraded our journal to OJS 3.1.0.1 and it is very disappointing to find that the italics tags that worked perfectly well in article titles for many years with OJS 2.x now do not render as we intended. I would stress, too, that this issue – the need for italicized words in the titles of academic articles – applies just as much to my field (musicology) and the rest of the humanities as it does to the biological sciences mentioned above, for humanities articles’ titles frequently refer to foreign-language words or existing literature using the normal convention of italics.

For examples, see Vol 12 (2016-17) | Journal of the Society for Musicology in Ireland (where the existing italics tags still work in the TOC) and Giovanni Battista Vitali’s Violone in the Accademia | Journal of the Society for Musicology in Ireland (where the same italics tags for Accademia do not work for either the article’s title or the renderings of citation methods.

2 Likes

I strongly agree with pauljeverett: this should be considered an important issue in OJS 3.

3 Likes

Hi there,

I’ve done the following to make italics work in article titles, but exclude them from metadata (DC.Title and citation_title) and the browser’s title bar.

You need to change some templates - there might be a better way to do it, but it works for me.

Replace “escape” by “strip_unsafe_html” in /ojs/templates/frontend/objects/article_details.tpl in the “title” and “subtitle” to make italics work on the article’s frontdoor

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

{if $article->getLocalizedSubtitle()}
  <h2 class="subtitle">
    {$article->getLocalizedSubtitle()|strip_unsafe_html}
  </h2>
{/if}

Replace “escape” by “strip_unsafe_html” in /ojs/templates/frontend/pages/article.tpl to strip html tags in the browser’s title bar

{include file="frontend/components/header.tpl" pageTitleTranslated=$article->getLocalizedTitle()|strip_unsafe_html}

Add “strip_unsafe_html” in /ojs/plugins/generic/dublinCoreMeta/DublinCoreMetaPlugin.inc in “DC.Title” to strip html tags in DC.Title

$templateMgr->addHeader('dublinCoreTitle', '<meta name="DC.Title" content="' . htmlspecialchars(strip_tags($article->getTitle($article->getLocale()))) . '"/>');

Do the same in /ojs/plugins/generic/googleScholar/GoogleScholarPlugin.inc.php in “googleScholarTitle”

$templateMgr->addHeader('googleScholarTitle', '<meta name="citation_title" content="' . htmlspecialchars(strip_tags($article->getTitle($article->getLocale()))) . '"/>');

Et voila - you will have italics an your article’s frontdoor, but no “em” or “i” html tags in the browser’s titlebar or in the DC.Title / citation_title metadata

6 Likes

See Inconsistent HTML display in article titles · Issue #2564 · pkp/pkp-lib · GitHub for a related issue.

2 Likes

My thanks to @bibliothekswelt for his solution above: it works for me. However, could the same fix (interpreting the italics tags in articles’ titles) be applied to the various citation formats too?
Paul

1 Like

Dear @bibliothekswelt,

I’m interested how you make sure that you get the latest changes in a template, when a new OJS release is coming out. Do you manually check every change/overridden template for changes? Or have you some automated workflow in place?

Regards,
Markus

Dear Markus,

at the moment we don’t have a workflow in place. The corrections should be added to a new OJS version, so I think the best way is to make a pull request in GitHub. However, I haven’t worked with GitHub yet, so I have to do a bit of “research” first, how to make this correctly.

Sebastian

I join the question - the problem is important for us too (we use OJS 3.1.0.1).

Dear Sebastian,

do you know what will happen with the html tags in regards to DOAJ for example? The DOAJ expects (akaik) plain text titles. We acutally had an article where <em> tags leaked over to the DOAJ. Will this still happen with your fix in place?

I think it would be the best to wait till the entering of html in the title field has been implemented properly and afterwards look for templates/plugins that expect plain text instead of html and make them handle the html properly. Then we don’t end up with unintended behaviour.

Regards,
Markus

I haven’t try in 3.1 but in 2.4.8 < i> < /i> works fine for italics

Hi you all,

Any news about this?
I’m having trouble too. Some articles have the scientific name in the title.
We usually write scientific names in italics.

Regards,
Tarcisio Pereira.

Put scientific name between code
image
it works for me

Hi all,

This is filed at Inconsistent HTML display in article titles · Issue #2564 · pkp/pkp-lib · GitHub for future work and the best place to watch for progress is on that issue. Currently italics in titles isn’t recommended or supported.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Worked in OJS 3.1.1.4

How did you make it work in OJS 3.1.1.4?

albah, Just like egroll said:
I changed in /templates/frontend/objects/article_details.tpl the line {$article->getLocalizedTitle()|escape} into {$article->getLocalizedTitle()|strip_unsafe_html}

1 Like

It seems to me that the need for italics in article titles has been a bit downplayed by the developers here: it would be absolutely necessary in many disciplines. Also, it would be great if the new implementation would take into account the fact that hundreds of titles exported from earlier versions of OJS would have html tags (<i> and <em>) in them. I have not deleted them in the 10 or so journals that we have migrated to OJS 3, in hopes that some day the italics would automagically appear again :slight_smile:

1 Like

Hi @ivovolt,

The latest update (as of today) on the git issue linked above is from June, indicating that the UI/UX changes introduced with recent vue.js work (which will be released with OJS 3.2) will facilitate things like adding italics support for titles. This may look like a minor change at first glance but you can see from the discussion there that it involves a lot of work and good alignment with other work in progress.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi Alec,

I am also following on this subject, because I really find this issue relevant (the possibility to show italic on titles and subtitles, since almost all the authors make use of them).
So I am looking forward for the 3.2 to come out.
All the best
Leonardo

Hi! This solution worked fine on previous versions, but we’ve uptdated to OJS 3.3.0.8 and the line

{$article->getLocalizedTitle()|` isn’t there anymore. It looks like it’s been replaced by

{$publication->getLocalizedTitle()

but replacing escape with strip_unsafe_html doesn’t seem to work.

What should we do?

Thanks in advanced!