Add the html.html.twig system template to manage classes for the body classes tag with Bootstrap 5

Created on 4 December 2022, over 1 year ago
Updated 30 May 2023, about 1 year ago

Problem/Motivation

Having no CSS classes for the body tag in the page.
Not having a html.html.twig template file.

  • When the page has a logged in user with the user-logged-in css class
  • When the page is a front page with the path-frontpage css class
  • When the page is a node page with the page-node-type- and the bundle name css class
  • When the site is off line db-offline
  • When having the navigation bar position with the navbar-is- and navbar position.

Proposed resolution

Have a html.html.twig file in Vartheme BS5
Following the way as in the Drupal core Olivero theme
https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/themes/olive...

Same as in the Gin theme
https://git.drupalcode.org/project/gin/-/blob/8.x-3.x/templates/html.htm...

with

{%
  set body_classes = [
    logged_in ? 'user-logged-in',
    not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class,
    node_type ? 'page-node-type-' ~ node_type|clean_class,
    db_offline ? 'db-offline',
    navbar_position ? 'navbar-is-' ~ navbar_position
  ]

%}

Remaining tasks

  • βœ… File an issue about this project
  • βœ… Addition/Change/Update/Fix to this project
  • βœ… Testing to ensure no regression
  • βž– Automated unit/functional testing coverage
  • βž– Developer Documentation support on feature change/addition
  • βž– User Guide Documentation support on feature change/addition
  • βœ… Accessibility and Readability
  • βœ… Code review from 1 Varbase core team member
  • βœ… Full testing and approval
  • βœ… Credit contributors
  • βœ… Review with the product owner
  • βœ… Update Release Notes and Update Helper on new feature change/addition
  • βœ… Release varbase-10.0.0-alpha1 β†’ , vartheme_bs5-2.0.0-alpha4 β†’

Varbase update type

  • βœ… No Update
  • βž– Optional Update
  • βž– Forced Update
  • βž– Forced Update if Unchanged

User interface changes

  • N/A

API changes

  • N/A

Data model changes

  • N/A

Release notes snippet

  • Issue #3325196 β†’ : Added the html.html.twig system template to manage classes for the body classes tag with Bootstrap 5
πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡―πŸ‡΄Jordan Abdullah Yassin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024