How to make italics in article title in OJS 3

The only solution I found for formatting the title in OJS is to import the articles from XML (using the XML import plugin).
You can use the < ![CDATA[< i>]] > (without the spaces between >< symbols) tag for the beggining of the italic format, and end it with < ![CDATA[< /i>]]>. This also works with strong, u (underline), em (emphasis), and other HTML tags.

THE ONLY PROBLEM IS THAT, IF YOU USE THIS METHOD, YOU WILL LOSE ANY HISTORY OF ARTICLE SUBMISSION

Formatting title in italics, bold or underline would be a useful feature for us too. We host a recension journal and people would like to format e.g. the title of the discussed book in italics.

@egroll @novikoffav Are you using the described workaround (code change in article_details.tpl) in a productive environment? The downside would be that the metadata output (like DC, citation format exports) will include the tags, is it right?

Hi all,

IIRC OJS 2.x allowed people to manually enter HTML tags into titles, and then stripped out those tags wherever they were unnecessary or problematic (using strip_tags as Alec suggested in Post 8). Would this not be a reasonable compromise for the time being? I’d be concerned about making “rich” and “plain text” options - that seems fairly complicated for the use case.

Cheers,
James

1 Like

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 https://musicologyireland.com/jsmi/index.php/journal/issue/view/14 (where the existing italics tags still work in the TOC) and https://musicologyireland.com/jsmi/index.php/journal/article/view/142 (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

5 Likes

See https://github.com/pkp/pkp-lib/issues/2564 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 https://github.com/pkp/pkp-lib/issues/2564 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}

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