Order by content type or taxonomy terms AND Search at a long webpage

Hello,

I have a page with many publications from my Experiment, which are in different subcategories:

  • Proceedings - Refereed
  • Proceedings - Unrefereed
  • conference proceedings
  • conference proceedings (unrefereed)
  • theses

These subcategories were different content types in the Drupal 7 version of the website, but have essentially the same data structure, because every publication has a title, a body and a upload field for pdf. I am not planning on changing that much.

I would like to have a site, in which theses subcategories still exist. My first question would be if it is better to order the publications site with the content types (therefore leaving them the same as in D7) or with taxonomy terms? How does that work?

And second question: Because the site with publications is very long, I would like to find a way in which I can have it more tidy but as a requirement it should be possible to search for key word. Example: search with CRTL + F at the old website. Would some of you have a suggestion to not have a long page and make it more user-friendly?

Thanks!

Hello Nadine,

Nice questions. I am answering each one of them below.

Problem

This is a typical case that you should use a combination of Content type and Taxonomy Vocabulary.

As you already mentioned, in D7 you had one content type per category and all of them had the same fields. This is in general a bad practice since they all pretty much represent the same thing so there is no reason to have separate content types for them. Imagine a simple case where you want to hide one field from displaying: If you have one content type then you just navigate to the display and you disable the field. If on the other hand you have 5 content types that do the same thing then you should change them in 5 different cases. Apart from being counter-intuitive to change the same thing in 5 different places, in more complicated structures the issue can easily scale. It is also very frequent to have inconsistencies.

Solution

What you should do instead is to have 1 content type (eg. Publication) and 1 taxonomy vocabulary (eg. Publication Categories).

  1. In the taxonomy page you create a new vocabulary (Structure > Taxonomy > Add Vocabulary)
  2. Then for each one of the categories (theses, proceedings - referred etc) you create one term.
  3. In the content type you will have the fields that you used to (body, upload field etc)
  4. In the content type you should also add 1 reference field to the vocabulary you created. Make this field required so that there won’t be any uncategorised publication.

Let me know if something is not clear.

This is a typical case where you should create a view. A view is a dynamic way to gather your content (in that case your publications) in one place. This place can be a block, or even a whole page.

By default Drupal offers some formats to render your content (grid, table, list etc).

In the CERN infrastructure we have some modules that provide extra formats like a list of teasers, carousel of cards etc. This is done using a combination of the CERN Display Formats module and the CERN Components module.

The format highly depends on what fields you want to render. So can you give more details on which fields of the publications you want them to be visible to the user (only title? title + body? etc) ?

Konstantinos

1 Like

Thank you for your detailed answer!

I’ve changed it now, so sorting would hopefully be no problem anymore.

I want it to display the whole content type:
Abstract, Author List, Publication source, PDF of publication and Publication category.
But because it is quite long to have one page of every publication, I wondered if there is a way to have a search field for all of the subcategories of the publication but only display let’s say the categories (refereed,…).

How many items are we talking about?

Also how long are those fields? For example the abstract of the publications. I am asking to see what type of format the view should have.

We are talking about approximately 95 publications.

The vary between the first picture size and the second picture.


Here is the link to what in now looks like: http://alpha.web.cern.ch/publications

I will have a look for this case and I will get back with a solution

Thank you!

Ok I did some tests in a clone site and I propose to use a view to gather publications in one page. The screenshot you add above is a view. What a view does is to gather nodes in one place. This can be a page (your case), a block, a feed etc.

1) Create a display to define how each publication will be displayed

We will setup the Teaser view mode to display each publications in 2 columns

  • Navigate in /admin/structure/types/manage/publication_content_type/display/teaser
  • At the bottom of the page choose Two column stacked layout and save the page
  • This layout has four regions: title, left, right and footer. For this implementation lets use the 3 first
  • Drag n drop the fields like in the image below

2) Create a view to gather and filter publications

  • Navigate to Structure > Views > Add view
  • Create a view. Choose Show Content of type Publication
  • Mark Create a page and choose Unformatted List of teasers. Also add a page title and a path. Click Save
  • In the next page add two exposed filters as in the screenshot below: one for title and one for publication category.
  • Under Pager, choose whether you want all publications to be shown or to display a pager.
  • Save the view

Try that and let me know if it works.

Konstantinos

That worked.

If I add title to the filter criteria, no content gets displayed. If I only add the publication category, with all the taxonomy terms, all content gets displayed.
But I would like to be able to navigate between the subcategories. Is it possible to create a few views with only one taxonomy term from publications (e.g.refereed publications)? Lets say I have 5 views, can I put them onto a single page?
Or maybe be able to collapse the different subcategories and have a search menu (because it would still be a really long page with all the publications)?

Can you send a link to the view settings?

You can do that using the publication category filter. If someone wants to see only “Proceedings - Refereed” publications, they can select this publication category so the view will filter them. Why do you need 5 views when you can can have 1 view with all the results and then the users can filter only the ones they want to see? Thats the power of filters right?

https://new-alpha.web.cern.ch/admin/structure/views/view/newstrial1?destination=/admin/structure/views

Right, I was confused for a second :slight_smile: I was sort of avoiding still having a long page, but If I have a filter menu, this would avoid having to scroll down.

Hello Nadine,

I checked your configuration and my comments are the following:

  • In order to make the filter available to users to change it, you need to mark the Expose the filter to visitors field so that user will be able to filter
  • Do that for both Publication Category and Title
  • Add the Title filter before the Publication Category

Try that and let me know

Konstantinos

That worked, thank you very much!