Vés al contingut
calbasi.net

Menú

  • Inici
  • Serveis
  • Portfolio
  • Blog
  • Tutorials
  • Contacte
Menú del compte d'usuari
  • Entra

Fil d'ariadna

  1. Inici
  2. Com es fa per...
  3. Drupal

HOWTO: Adding node type class to body element in Drupal 8

Per joan, 5 gener, 2017

Method 1: edit your html.html.twig theme template

Add this line at   <body{{ attributes.addClass(classes,:

    node_type ? 'page-node-type-' ~ node_type|clean_class

For example:

  <body{{ attributes.addClass(classes,
    not is_front ? 'with-subnav',
    sidebar_first ? 'sidebar-first',
    sidebar_second ? 'sidebar-second',
    (sidebar_first and not sidebar_second) or (sidebar_second and not sidebar_first) ? 'one-sidebar',
    (sidebar_first and sidebar_second) ? 'two-sidebars',
    (not sidebar_first and not sidebar_second) ? 'no-sidebar',
    node_type ? 'page-node-type-' ~ node_type|clean_class
  ) }}>

Method 2: Try node_type_class module

 

css class
node type
Drupal
Drupal 8
  • Versió per a imprimir

Enllaços relacionats de HOWTO: Adding node type class to body element in Drupal 8

  • Drupal Commerce: mostrar preu al formulari Add to Cart
  • Amunt
  • HOWTO: Com crear alies d'URL als nodes de Drupal 7

Navegació del llibre

  • Administració de sistemes
  • CiviCRM
  • Correu electrònic
  • Drupal
    • HOWTO: Com substituir taules per DIV des de ckeditor, per usuaris amb rol d'editor
    • Còpia de seguretat de la web
    • HOWTO: Creació d'un mapa d'establiments a google maps a partir de les adreces d'un full de càlcul
    • External links
    • Llista de correu sobre drupal en català
    • Destacar continguts a la portada
    • Drupal 6
    • Drupal Commerce: mostrar preu al formulari Add to Cart
    • HOWTO: Adding node type class to body element in Drupal 8
    • HOWTO: Com crear alies d'URL als nodes de Drupal 7
    • HOWTO: jump menus in Drupal 8
  • Moodle
  • Calaix de sastre
  • Dolibarr
Canal RSS
Funciona amb