gbif / hosted-portals

Support material for establishing the GBIF Hosted Portals
Apache License 2.0
10 stars 6 forks source link

routeConfig : add a Typus search/key to the routes of the data display #295

Open morelanneIF opened 3 months ago

morelanneIF commented 3 months ago

# My problem How can I make a custom route specifically displaying Typus specimens ?

# My current situation I found the full default list (https://hp-theme.gbif-staging.org/data-exploration-config#adding-more-than-occurrences), I created both search.md and typusKey.md files (https://github.com/gbif/hp-svnhc/tree/master/en/data/typus) and I also tried the code provided in ticket 217 (https://github.com/gbif/hosted-portals/issues/217) but it still doesn't work....

At the moment, my routes code looks like that:

  routes: {
    enabledRoutes: ['occurrenceSearch', 'institutionSearch', 'institutionKey', 'collectionSearch', 'collectionKey', 'datasetKey', 'datasetSearch', 'literatureSearch'],
    typusKey: { url: ({key}) => `/typus?key=${key}`, isHref: true },
  },

it works for the occurrence/dataset/institutions, but when trying typus/search, it shows the small "Select a route to start" menu.

# My goal Display the typus data just like the occurrence data but excluding the type_status=NOTATYPE

MortenHofft commented 3 months ago

We do not really have a way to do that well at the moment. We do not have a good way to add multiple occurrence search pages with different configurations. There can only be one. And this is also the one that dataset pages etc will link to for displaying records.

Do I understand that what you are aiming for is a search similar to occurrence search but only for type specimens? And then a way to display the individual specimens on a page of their own?

morelanneIF commented 3 months ago

Thank you for your answer.

Yes, it is exactly that. We will show in occurrence the specimens of all swiss natural history institutions, and among them we have typus, which would be specifically displayed on their own page.

I wrote this code based on the one for the collection/institutions/literature/etc... but since there is no enabled route for typusSearch/Key, it does not work

typus: {
    excludedFilters: ['countryGrSciColl'],
    rootFilter: {
      predicate: {
    displayOnNHCPortal: true,
        type: 'and', predicates: [
          {
            type: 'in',
            key: 'country',
            values: countryCode
          },
          {
            type: 'not',
            key: 'typeStatus',
            values: "NOTATYPE"
          }
        ]
      }
    },
  },

Would it be doable ? (I suspect I made some mistakes in my code...)

MortenHofft commented 3 months ago

No it isn't something that you can do currently. I'll keep it mind, but as it is now you cannot have multiple occurrence search.

Perhaps you could get the search working, by providing your own layout to jekyll, but I wouldn't be able to guarentee that it would continue to work. And individual specimens wouldn't get their own url anyhow.

I think that your best option within the current constraints is to simply predefine a link to the type specimens It isn't a great solution and it doesn't solve the issue of individual type specimen pages.

morelanneIF commented 3 months ago

Thank you very much for your help ! A provisional solution is still better than nothing, even if it is for a long time.

Still it would be really useful if we could create our own routes and search/key for specific criteria. Should I notify this request somewhere else for future updates ? Or is it enough if you keep it in mind as you said ?

Thanks again, and I wish you a nice week

MortenHofft commented 3 months ago

We are in the process of aligning gbif.org and hosted portals. So I try to develop as little as possibly on hosted portals at the moment. And instead focus on aligning the sites to avoid maintaining multiple code bases. The goal is to be able to respond quicker to feature requests going forward, but it does mean that we are a little slow at implementing new features at the moment.

It isn't the first time it has come up, you do not need to create another issue than this.

Do you have any specific requirements/wishes for a type specimen page? Do you have a mockup or a design in place already?

morelanneIF commented 3 months ago

Thank you for your answer. At the moment not really no... I find the occurrence layout with table, map and gallery already quite satisfying for displaying the typus.