OJS 3 – static pages and breadcrumbs

Is it possible to add breadcrumbs to static pages? I can create static pages, I can add them to the main menu and/or submenu, but how can I add breadcrumbs to them?

You would have to edit the plugin GitHub - pkp/staticPages: Plugin permitting the creation of static pages like a CMS (OJS 3.0+ and OMP 1.1.1+)
But at the moment static pages do not have a taxonomy, meaning that all the breadcrumbs would look like: Main => Page name.

That said, this could change if the static pages plugin is connected to the forthcoming navigation feature: https://github.com/pkp/pkp-lib/issues/2178

This kind of breadcrumbs would be quite nice for us, at least for the beginning.

But could you please provide more details about plugin modification? What files/entries should we edit, etc. Thanks!

Well you could try adding something like
{include file="frontend/components/breadcrumbs.tpl" currentTitleKey=$title}
after (not before) this line https://github.com/pkp/staticPages/blob/master/templates/content.tpl#L13

Can’t promise what the outcome is :grinning:

edit: I actually noticed that all the page breadcrumbs have only two levels, so I guess that would be an ok addition to the staticpage plugin.

Wow :wink:

I tried the following code:

{include file="frontend/components/breadcrumbs.tpl" currentTitleKey=$title}
<div class="page">

Here is the result:

Not bad, but I don’t understand the reason of ## - there are no problems with menu items names…

Ok, maybe instead adding these two lines:

{assign var=currentTitle value=$title}
{include file="frontend/components/breadcrumbs.tpl"}

You could also test that without the first line there.

No, without the first line we have only Home…

However with two lines - bingo!

Thank you very much!

1 Like

Hi there,

is manipulating the content.tpl (which would get erased via the next update) still the only possible option for adding a breadcrumb to static sites? I am running OJS 3.1.1.

I had the same question (missing breadcrumb on static sites) and found this solution (which works fine) but also read that these two lines could be integrated into the static page plugin.

Thank you.

I do not think this is included in the static pages plugin. But did you check if the pages created with the navigation menu have a breadcrumb?

Pages created via static sites are missing the breadcrumb. I just checked on our testserver: sites which are added via the navigation menu are also missing the breadcrumb.

At first we tried to just add a fake breadcrumb by coping the breadcrumb code from another page into the static site via the code-editor but then we had two h2-page-titles and the breadcrumb between. This wouldn’t have been a problem if we could have added an additional CSS … section into the static site with which we could give a display none to the first-child h2. But the site editor does not allow us to infuse a -section into the code of the static site - it would always just disappear when saving.

You could of course add the modified template to a child theme. This way you would not loose the changes when upgrading.

And of course you could do a feature request concerning the breadcrumbs.

I guess feature request would be the best way since I guess other users would also like this feature. It just adds to an overall uniform site design. Instead of having some sites with and some sites without breadcrumb.

We upgraded to and faced with the problem of breadcrumbs for static pages. Although I copied previous changes to content.tpl, in the current version the breadcrumbs do not work.
In website settings we do not currently have static pages on the corresponding tab, they are correctly transferred to the navigation menus when updating. But we would like to have breadcrumbs on these pages. What can we fix to solve this problem?

I guess this is the correct template to edit now: https://github.com/pkp/pkp-lib/blob/master/templates/frontend/pages/navigationMenuItemViewContent.tpl

1 Like

Yeah, perfect! It works for us! Thank you.