Hello everyone !
I'm quite new to Drupal 8 and Drupal in general and I'm stuck at some point on a website for a client.
I created a global layout with a custom theme I coded myself, and added a custom content type for the home page. I have almost exactly what I want except for :
1. I should have a block somewhere in the home page containing the last 3 articles posted on the website, and of course, a link to each of these article. How am I supposed to do that ? All answers I found were talking about Drupal 7.
2. I'm supposed to do the same as the last articles but for photos albums, I guess that I'll have to use a module ? Do you have any good to suggest me ?
Thank you all in advance !
PS : sorry if there is any english mistake, this is not my mother tongue.
Comments
create views
1. I should have a block somewhere in the home page containing the last 3 articles posted on the website, and of course, a link to each of these article.
For this you can create view block select node type which you want and sort it by post date and set pagination for display 3 post.
2. I'm supposed to do the same as the last articles but for photos albums.
You can use view as same for photo albums.
please check views tutorials so it will helpful for you.
Raj Laddha
cmsMinds
rajesh@cmsminds.com
Drupal Development - North Carolina
View block
Thank you for your response !
I just created a view named "blog" with your advice but now, how do I add this view into my theme's code using Twig's "blocks" ? With something like this "{{ view.blog }}" ?
Regions
Your template should specify regions. Drupal provides a UI for placing blocks in regions.
See https://www.drupal.org/docs/8/theming-drupal-8/adding-regions-to-a-theme