drupal 8

If you know how to make a content type template in drupal 7 then you can easily understand in drupal 8, Here there is not much change except that the template is in twig format. 

For creating the content type template in drupal 8 you have to do two things :

1) Add this code in your mytheme.theme file in your working theme folder :-

function hook_theme_suggestions_page_alter(array &$suggestions, array $variables) {
  if ($node = \Drupal::routeMatch()->getParameter('node')) {
    $suggestions[] = 'page__' . $node->bundle();
  }
}

above code helps to recognized drupal 8 to work with specific content type template.

(Note: replace hook with your theme name)

2) Now copy page.html.twig and rename it wit your content type name like

e.g  page--article.html.twig

 

clear the cache and Done.

Comments

Submitted by ginobeh844581710917 (not verified) on Sun, 06/16/2019 - 12:45

Permalink

Good way of describing, and pleasant paragraph to get facts regarding my presentation focus, which i am going to convey in university.

Submitted by Staci (not verified) on Mon, 07/22/2019 - 03:23

Permalink

Thank you, I have just been searching for information approximately this topic for a while and yours is the greatest I've
discovered till now. However, what concerning the conclusion? Are you certain concerning the source?

Add new comment

Other Articles

Changing the year range in the form's date element drupal form api

Drupal form api ap usually used to build the custom form to extended the functionality of drupal according to your need.

Change all files and folders permissions of a directory to 644/755

Find is best command to apply permission to directories and files recursively to all . For Directories

Drupal 8 mutlisite setup

In Drupal 8 Multisite setup is almost same as the Drupal 7.

[SOLVED] PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting

If you get the same error like below in VScode editor then you are the right place to 

Wordpress Error with php 7.1 - PHP Fatal error: Uncaught Error: [] operator not supported for strings

Hey, This is error caused by php7 and later,many application will face this error Reason behind is that the php 7 will not convert the blank variable with is define as string to array:

Nodejs With Xampp

Hello Guys, We can easily connect the Nodejs with xampp by follow simple steps -

Reindex the Array keys

Sometimes we need to slice the array for certain values using program a code and at that time key of array is also unset. If you faced the same then you can use these options

Slice array Elements using Keys PHP

Many Helpful Function are available to exact the specific set of keys of an array $sliced-arr = array_slice($new_tags, 0, 6);

what is namespace in PHP?

https://stackoverflow.com/questions/3384204/what-are-namespaces

Html Dom parser to Extract the HTML data from Html page

Html Dom parser to Extract the HTML data from Html page  See the attached Zip file 

Schema API Drupal not accept the datatype like date or datetime

Schema  Api Drupal 7 and Drupal 8 not accept the datatypes Like data or datatime and generate the warning and sql syntax error while installing the drupal module in install  normally we

Embed Google maps on website (Static address )

Here using this website  we can get the embed the static map on our website.

Bootstrap subtheme dropdown Drupal 7

Steps to create sub theme and mutilevel dropdown :-

Check the size of folder, files and directories using SSH

Following commands(In Bold) used for different purpose  1. Use df -h For check out the used space, free space and total space From all the partitions.

Convert a certificate into the cer,crt,der,pem format

For different reason we need the different format of certificates for different operating system, many of sites offering you to convert the certificates in different format online but if you have b

Update Drupal 8 core manually

This is small tutorial to how to update the Drupal 8 core manually using shell or FTP, Let start -

Getting permission error when installing CiviCRM under Drupal with Xampp

If you are getting permission error while installing CiviCRM on xampp then, its is default CiviCRM user permission error,

Facebook post customisation posted using web app using Facebook Open Graph

Facebook is Providing autoposting functionality using website application and provides to display you website content on your facebook page.

send Variable to Js File From PHP in drupal Custom Module

If we need to use the php variable in our js file we can use Core Drupal.settings Functionality :  example:

How you can get Mailchimp API KEY

By Follow steps below, you can find the api key or create the api key at mailchimp and use it to your website to connected the site with mailchimp to collect the subscribe in fastest way.

Facebook, Twitter and LinkedIn post share checker

Social media apps like Facebook, twitter linked allow your website and apps to share on there pages to reach with more peoples.

Subtract two angularjs dates

hey, Here you get how to subtract to date in angularjs with core functionality

Recent Posts

[SOLVED] PHP executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting

If you get the same error like below in VScode editor then you are the right place to 

Redirect Old Domain to New Domain via .htaccess

Usually we develop the site on developement or subdomain and when we finally mirgate the to new domain then some of thing will remain or page redirect happens in  sometimes , so In this case .htacc

Create a Flag link programmatically and render flag link in twig template drupal 8

This article is refer to generate the flag link programmatically and render in drupal 8 twig template, before in drupal 7 its was quiet easy to render or generate flag link in just a single line of

Jquery prevent enter to submit form

If you want to prevent the form submit using jquery, then this page helps you to doing this.

Code:

Play Pause HTML5 Video using Jquery

HTML5 video playing on any web page is very easy, in this tutorial we can show you how to add video on html and make it play and pause without using html controls.

Import and Export Drupal 8 Views, Or Import and Export any configuration Drupal 8

Import and Export configuration is the basic protocol to staging the website or production website deployment, In Drupal 7, we need the extra modules to import and export or we can use features mod

How to override different version of Jquery in Drupal 8 using theme

Drupal 8 use its own jquery version by default and if you want to use the other version of jQuery instead of default than this tutorials steps is for you, sometimes we need different version to oth

Subscribe to Mailchimp programmatically via api with PHP

In this tutorial we can see how to subscribe to the mailchimp subscribe list using php programmatically via api,

For this you need a mailchimp account, api key and list id 

How you can get Mailchimp API KEY

By Follow steps below, you can find the api key or create the api key at mailchimp and use it to your website to connected the site with mailchimp to collect the subscribe in fastest way.

How to get your MailChimp LIST ID

Mailchimp is marketing automation platform and is provide email for marketing your product or business whatever you like, today its most trusted service providing all over the globe.

Drupal 8 add custom menu classes to using menu.html.twig

In Drupal 8 Twig templates give extra power to drupal to add dynamic content in twig style, In this tutorial we can see how we can add the custom menu classes to menu ul li using menu.html.twig.