How would I go about creating a block that displays the current page's author name, picture and short bio? I'm new to Drupal and don't know if this is done using a View block, custom block or by editing a block template. The block should only display if in a page or certain content type.
This will be little bit lengthy process but can be done. This you can do by Views module which is in core in Drupal 8, BUT before that you have to do some other stuff with the user account. The entire process I am listing out in steps.
Since your question is not complete clear, I am providing the method for Author Info only, if you clarify I will add the second part.
Author Info Block
- Adding - Bio field & Social media profile field
- Creating Views.
- Add created block to appropriate place.
- Block visibility setting
1. Adding - Bio field & Social media profile field
Now, the user profile setting do not provide the Bio field by default hence we need to create that one.
1.1 Go to Configuration>Account Setting>Manage field
1.2 Add new field name: Bio, field type: Long text(formatted, long)>save
1.3 Add new field Social Links: Install and enable the Social Profile Field. What this module does, this module provide the field which provide the provision for adding the social media links, The link will automatically converts to ICONS, that is the good part.
Again go to Configuration>Account Setting>Manage field and add new field Social link and for this choose field type: Social profile field. Note: The picture field is by default, which provides by core.
Now, Under the user profile- Bio and Links will be added as new field so you can add this by going under Edit of any user profile.
Now, we add set to go for Views,
2. Creating Views: Author info
2.1 Go to Structure>Views.
2.2 Add new view: Author Info. Select Users in views setting. Select Create a block in Block setting. Set Unformatted list of Filed under Block display settings. Select 1 under items per block. Click->Save and edit.
2.3 Views setting page:
2.3.1 Now add Relationship: Go under Advanced setting. under relationship click add and from the list select Content Author, give it a name Author node as shown in the following image of 2.3.4.
2.3.3 Come under FIELDS and add following field: Picture(category: User), Bio(category: User), Links(category: User).
2.3.4 Remove anything which is under the FILTER CRITERIA. Save it. Your final views setting page will be looks like this,
3. Add the created block: Go to Structure>Block> and under first sidebar add this block.
4. Block visibility setting: Now, till this step, everything works fine, but these blocks are not visible to Anonymous user, And to set that, Go to Again go to views setting as shown in just above image, under BLOCK SETTING > Access click permission and select none option, and save. Now, this block will be visible to all users.
Output Image: I have reprocessed this above mentioned process in my Drupal 8 trial site and you can see in following image, with all Author info. on only page which has been authored by that author.
Create a new View, of
Show: users and checkmark block
Add the fields you want, user pic, user name, etc...
Under Advanced, Add CONTEXTUAL FILTER of User ID with these settings:
Your view preview will go blank, which is normal here, since views is not able to get the node author from the view url. The view will show up when you go to the page/node where you placed the block.
Now create a another user block view. This will be the "Latest Stuff". This time under advanced, add RELATIONSHIP of
Add your title field and other fields you want.
Use same contextual filter as the 1st view.