Fix for broken anchor links in Publication Facts plugin (#author-list, #data-availability-statement)

I am currently working with OJS 3.5.0.3 and would like to share my experience fixing an issue with broken anchor links in the Publication Facts plugin. I hope I was the only one who ran into this problem, but if anyone else encounters it, here is the solution.

In line with the policy of open and transparent data, the Ministry of Education and Science of Ukraine requires this information to be publicly accessible. Because of that, we needed to display these metadata fields directly on the article page. However, the journal’s theme (Pragma) did not include any code for rendering this metadata, which meant that the anchor links had nothing to attach to. As a result, the links were broken and that’s what triggered the issue.

I edited the article_details.tpl template file (in my case, it was located at plugins/themes/your_theme_name/templates/frontend/objects/article_details.tpl).

To make this metadata visible, I added custom code directly before the {* References *} block.

In the condition {if $currentLocale == 'uk'}, I’m using the uk locale code for Ukrainian.
If your journal uses another locale format (e.g., uk_UA, fr_CA, es_ES), make sure to replace uk with the exact locale code used in your OJS installation.

While preparing the code examples and testing the solution, I also used Gemini Pro to assist with generating and refining several code fragments.

{* Competing Interests *}
{assign var="hasCompetingInterests" value=false}
{foreach from=$publication->getData('authors') item=author}
    {if $author->getLocalizedData('competingInterests')}
        {assign var="hasCompetingInterests" value=true}
        {break}
    {/if}
{/foreach}

{if $hasCompetingInterests}
    <hr>
    <section id="author-list" class="competing-interests">
        <h2>
            {if $currentLocale == 'uk'}Конфлікт інтересів{else}Competing Interests{/if}
        </h2>
        {foreach from=$publication->getData('authors') item=author}
            {if $author->getLocalizedData('competingInterests')}
                <p><strong>{$author->getFullName()|escape}:</strong> {$author->getLocalizedData('competingInterests')|strip_unsafe_html}</p>
            {/if}
        {/foreach}
    </section>
{/if}

{* Data Availability *}
{assign var="dataAvailability" value=$publication->getLocalizedData('dataAvailability')}
{if $dataAvailability}
    <hr>
    <section id="data-availability-statement" class="data-availability">
        <h2>
            {if $currentLocale == 'uk'}Доступність даних{else}Data Availability{/if}
        </h2>
        <p>{$dataAvailability|strip_unsafe_html}</p>
    </section>
{/if}

I am providing a photo of the webpage.

Hi @Oleksandr_Radkevych,

The default theme is our “reference theme” and should support all options; the other “official” PKP themes may lag behind or not support all features, which is what you’ve run into here. If you’d be willing to submit a pull request to add the missing sections to the Pragma, I’d be grateful!

Thanks,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 9 days. New replies are no longer allowed.