4

I've created an about us page on a Drupal 8 site that is a view displaying people on my site (in alphabetical order) that were generated from a custom member content type.

The page is basically a "Card" type look for each person in a 3 column grid.

What is the correct way to add an introductory block of text above this view listing? Is adding a custom block of text to the header portion the best way of doing this still? I can't seem to find any recent answers to this question. Is this easy for content editors to alter afterwords?

5

Under "Header" select "Add" and choose "Text area" or "Unfiltered text". Then fill in your text in the text area and click "Apply".

Add a global header

You will need to provide content editors access to your view in order to alter it.

Another option would be to create a custom block and to place it above the Main page content block. Then again, you will need to provide access to the content editors to administer blocks.

  • 1
    Alternative approach that will require a bunch of contrib modules and result in a pretty different Content creation workflow is using Paragraphs and drupal.org/project/viewsreference, then you can have a View paragraph type and mix text and views in whatever way you want, without giving your editors special permissions. – Berdir Jan 23 '17 at 21:02
3

You could also try to do this the other way around. The view is 'fixed', and you want to have the node remain editable.

It appeared this did not work the way I had in mind. You want to show the view on that specific page only and because in views there is no relation between the users and the specific node, so there is no possibility to show the content only on the given node id (the view will be attached to all nodes). EVA is a great module for situations where there is such a connection though.

For example, you might make a View that displays posts with an 'Author ID' argument, then use Eva to attach the view to the User entity type. When a user profile is displayed, the User's ID will be passed in as the argument to the view magically.

Original answer

By creating a basic page with your introduction text and using Entity Views Attachment (I have not tried the 8 version, but for Drupal 7 it worked nice). You configure it from within views, and then choose to attach it to the node. The node remains editable as every other node.

New answer

Since EVA is not a good solution. Let's make a block. If you create a view block that lists your users. Place the block below your content block in the blocks configuration and then change the visibility preferences. Just enter the path to your content (/node/1 or something similar. It is favorable to use the node id, because the URL alias can change more easily.).

Block visibility

A lightweight alternative could be to use the Global: Rendered entity - Content display in the views header area. This will allow you to embed the complete node in the view. But in this case you will have access to the node via its regular path and the path of the view, which might be undesirable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.