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

Created on 4 December 2022, about 2 years ago
Updated 30 May 2023, over 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.71.5 2024