DSpace 8.0: Search Tab on Community/Collection pages

416 views
Skip to first unread message

Дмитрий Черных

unread,
Jun 26, 2024, 7:26:33 AM6/26/24
to DSpace Technical Support
In DSpace 8.0 all Community and Collection pages now include a "Search" tab. Is it possible or to completely disable this tab or at least make it non-default? I want the "Subcommunities and Collections" tab to open by default, not a "Search" tab.

Thanks.

DSpace Technical Support

unread,
Jun 26, 2024, 5:45:09 PM6/26/24
to DSpace Technical Support
Hi,

At this time, in DSpace 8, it's not configurable to change the default tab for Communities & Collections.  However, I think it'd be possible to change in code (I have to admit though that I haven't tested this myself)

The code which decides the tab ordering is all in "comcol-page-browse-by.component.ts" in the "ngOnInit()" method:


In that method, you can see it uses different tabs for "collection" vs "community".

The collection starts with a "search" tab, but then has other browse-by tabs (there is no "Subcommunities and Collections")
The community starts with the "search" tab, followed by "comcols" (Subcommunities & Collections) followed by all other browse tabs:
* (Uses the same set of browse by options as collections)

So, you might be able to just reorder the tabs in this page to get the behavior you want.  But, there is no configuration to do this at this time.

If you'd rather, you can also submit a ticket (https://github.com/DSpace/dspace-angular/issues to request a way to configure this.  Then, we'd search for a volunteer who is willing to work on adding such a configuration (as all development for DSpace is done by volunteers).

Hopefully that's helpful!
Tim

Abel Gómez

unread,
Jun 26, 2024, 6:02:23 PM6/26/24
to DSpace Technical Support
Hi all,

I'm also interested in this, and when I tested DSpace 8 I think I tried something like the approach proposed by Tim and it didn't work (and as a consequence, I postponed the upgrade).

I'm talking from memory, but the main problem is that the "initial" active tab in the communities and collections page is selected based on the last segment of the community URL (and not the order of appearance).

In DSpace 7, the subcommunities and collections tab was rendered when the base URL for the community was navigated, e.g.:


But in DSpace 8, the URL for the subcommunities and collections has the "/subcom-cols" suffix, e.g.:


The default page for a community (in the above example "https://sandbox.dspace.org/communities/8b632938-77c2-487c-81f0-e804f63e68e6"), will always activate the "search" tab (which has no suffix), independently of the order of the tabs.

Thus, to activate the subcommunities and collections tab all links to communities and collections in DSpace would have to include the "/subcom-cols" suffix (which doesn't seem an easy fix to make).

Maybe the "https://sandbox.dspace.org/communities/8b632938-77c2-487c-81f0-e804f63e68e6" can directly redirect to "https://sandbox.dspace.org/communities/8b632938-77c2-487c-81f0-e804f63e68e6/subcoms-cols" (or whatever other preferred tab) but that would require that the search tab has its own "/search" suffix in the URL.

When I found the above issue I gave up since I wasn't able to find a satisfactory and straightforward solution.

Please, let me know if I'm mistaken. I'll be happy to be :-)

Abel

Abel Gómez

unread,
Jul 3, 2024, 6:08:49 PM7/3/24
to DSpace Technical Support
Hi all (again),

to continue with this discussion, I finally had time to take a closer look to this issue taking into account the problem with the URLs.

I have created the following PR to make the default tab when browsing a community/collection configurable:


In any case, the changes to implement an ad-hoc solution are not too many.

Besides reordering the tabs as suggested by Tim in the previous message, it would also be necessary to modify the routes of some components. Something like the following should work:
  1. Specify a path (such as 'search') for the 'ComcolSearchSectionComponent': https://github.com/DSpace/dspace-angular/blob/c3a26ea89e235b5b9cd83c57704ceb045adce3e1/src/app/community-page/community-page-routes.ts#L75
  2. Remove the path for SubComColSectionComponent: https://github.com/DSpace/dspace-angular/blob/c3a26ea89e235b5b9cd83c57704ceb045adce3e1/src/app/community-page/community-page-routes.ts#L80
  3. Optionally, also define breadcrumbs.
  4. Also modify "collection-page-routes.ts" similarly to "community-page-routes.ts"
  5. Adjust the https://github.com/DSpace/dspace-angular/blob/main/src/app/shared/comcol/comcol-page-browse-by/comcol-page-browse-by.component.ts file according to the new routes (e.g., lines 102, 109 and 114).
  6. Optionally, reorder the tabs as desired.
Hope this helps.

Cheers!

Abel
Reply all
Reply to author
Forward
0 new messages