[OJS 3] Archives -- Group by Year

Hi! Large archives with hundreds of issues look a bit ‘crowded’. It’s hard to navigate and hard to find certain issues in such long lists. We would suggest an (optional) feature to group issues by year on the ‘Archives’ page.

Example:

3 Likes

That is a really nice layout. At the moment some of our journals have this in templates/frontend/pages/issueArchive.tpl. It basically prints a year header to the list.

  <ul class="issues_archive">
  	{iterate from=issues item=issue}
  		{if $issue->getYear() != $lastYear}
  			<li><h3>{$issue->getYear()|escape}</h3></li>
  			{assign var=lastYear value=$issue->getYear()}
  		{/if}
  		<li>
  			{include file="frontend/objects/issue_summary.tpl"}
  		</li>
  	{/iterate}
  </ul>
1 Like

Hi @ajnyga,

Would you please give some URLs to such journal archives? Thanks!

I will send you a link in a private message. I do not want to post a link to one of our journals without asking a permission from the editor.

1 Like

This is quite nice. At the moment we do the grouping by year via having a section for each year. That’s not very elegant, but it works, too.
So thanks for sharing your code @ajnyga .

I would like to have something like this:
http://jmhs.cmsny.org/index.php/jmhs/issue/archive
I can create static page and eneter all that is needed by hand. But, I would like if that should be done automatically.

Thanks

No-one comment how to present year of published issue in Archive. For more published issues is hard to search and look. It was better in OJS 2.x where every year was presented with published issue. How to do that in OJS 3.x?
Thank you in advance.

2 Likes

Hey there,
the same here. Our Journal publishes 12 issues per year since 2009! Navigation is very inconvenient.
It would be nice to have a superior sort order. archive: year: issue: articles.
Thank you!

1 Like

One possible workaround is to use Ctrl F in your browser to find and type let say 2016 and it will easily find all issues in 2016.
For that reason, in journals we always include year and order them according to year so it is easier to find especially by using Ctrl F if there are many years for larger archives.
Maybe this helps.

No. This is not practical. OJS is so sophistic to use that sample method. I meant to back option as they had in OJS 2.x.
image

You can accomplish that by editing the templates/frontend/pages/issueArchive.tpl with the code I posted above.

Is this code that you mentioned above `

  <ul class="issues_archive">
  	{iterate from=issues item=issue}

  		{if $issue->getYear() != $lastYear}
  			<li><h3>{$issue->getYear()|escape}</h3></li>
  			{assign var=lastYear value=$issue->getYear()}
  		{/if}

  		<li>
  			{include file="frontend/objects/issue_summary.tpl"}
  		</li>
  	{/iterate}
  </ul>

`

yes, I use it in a couple of journals we have. Let me know if that is not working, can not remember if I have made changes to it during OJS version changes.

Yes, I confirm it is still important for many of our journals.

Dear @ajnyga
This code doesn`t work in OJS 3.1.1.1. Nothing happened. I insert it at the end of code, change the old code with yours but nothing. Could you be precise where we need to insert this code? In which line?

I have done that in OJS 3.1.0.1
https://eap-iea.org/index.php/eap/issue/archive
Please check image how my code looks like.
Screenshot_2018-09-07_12-18-02
you can delete once lines related to fronted/object/issue_summary.tpl since I put them twice.

Hi,

The code above works in OJS 3.1.1.2 as well.

Here is the modified templates/frontend/pages/issueArchive.tpl file. Replace the content of that file with the code below. If nothing happens, then you are probably using a theme that has it’s own issueArchive.tpl template so you have to add the changes to that file instead.

{**
 * templates/frontend/pages/issueArchive.tpl
 *
 * Copyright (c) 2014-2018 Simon Fraser University
 * Copyright (c) 2003-2018 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @brief Display a list of recent issues.
 *
 * @uses $issues Array Collection of issues to display
 * @uses $prevPage int The previous page number
 * @uses $nextPage int The next page number
 * @uses $showingStart int The number of the first item on this page
 * @uses $showingEnd int The number of the last item on this page
 * @uses $total int Count of all published monographs
 *}
{capture assign="pageTitle"}
	{if $prevPage}
		{translate key="archive.archivesPageNumber" pageNumber=$prevPage+1}
	{else}
		{translate key="archive.archives"}
	{/if}
{/capture}
{include file="frontend/components/header.tpl" pageTitleTranslated=$pageTitle}

<div class="page page_issue_archive">
	{include file="frontend/components/breadcrumbs.tpl" currentTitle=$pageTitle}

	{* No issues have been published *}
	{if empty($issues)}
		<p>{translate key="current.noCurrentIssueDesc"}</p>

	{* List issues *}
	{else}

	  <ul class="issues_archive">
	  	{foreach from=$issues item="issue"}
	  		{if $issue->getYear() != $lastYear}
	  			<li><h3>{$issue->getYear()|escape}</h3></li>
	  			{assign var=lastYear value=$issue->getYear()}
	  		{/if}
	  		<li>
	  			{include file="frontend/objects/issue_summary.tpl"}
	  		</li>
	  	{/foreach}
	  </ul>

		{* Pagination *}
		{if $prevPage > 1}
			{url|assign:"prevUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$prevPage}
		{elseif $prevPage === 1}
			{url|assign:"prevUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive"}
		{/if}
		{if $nextPage}
			{url|assign:"nextUrl" router=$smarty.const.ROUTE_PAGE page="issue" op="archive" path=$nextPage}
		{/if}
		{include
			file="frontend/components/pagination.tpl"
			prevUrl=$prevUrl
			nextUrl=$nextUrl
			showingStart=$showingStart
			showingEnd=$showingEnd
			total=$total
		}
	{/if}
</div>

{include file="frontend/components/footer.tpl"}
4 Likes

Yes. That is it. The code works. Thank you a lot.

It’s possible to create an overview about all Volumes. I would like to have a smal menu, that the user can selected between the different volumes. For example:

2015 | 2016 | 2017 | 2018 | 2019

Because we have 50 volumes with more than 200 issues and in the actual archiv, it is very difficult to find a singel issue.

I made Journal archive toggle. Maybe someone can use it.

2 Likes