I'm using an old version of this theme so you may have fixed this already but I was noticing the body tag does not have the current url of the page which makes customizing the theming a little harder. I noticed you can fix this by adding this to the .theme file:

Under this line...
function openy_carnation_preprocess_html(array &$variables) {

Add

  // Get the current path
  $current_path = \Drupal::service('path.current')->getPath();
  $internal_path = \Drupal::service('path_alias.manager')->getAliasByPath($current_path);

  // Assign it to body class 
  $variables['attributes']['class'][] = str_replace("/", "", $internal_path);

Apologies if you've already fixed this or if this isn't the best way to do this, it worked great for me. Thanks for your hard work!

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

plato1123 created an issue. See original summary.

podarok’s picture

Status: Active » Needs work

Hi @plato1123
Could you create a Merge request with this change?
Thank you in advance

Anchal_gupta made their first commit to this issue’s fork.

anchal_gupta’s picture

Status: Needs work » Needs review

Committed and MR as per the suggestion provided.

podarok’s picture

Version: 1.1.4 » 1.0.x-dev
Status: Needs review » Fixed

merged in 1.0.x

podarok’s picture

Version: 1.0.x-dev » 2.0.x-dev
Priority: Normal » Major
Status: Fixed » Needs work

Needs upport to 2.0.x branch

  • podarok committed 4267cfd on 2.0.x
    Issue #3305569 by podarok, Anchal_gupta, plato1123: Add current page...
podarok’s picture

Version: 2.0.x-dev » 2.0.9
Assigned: Unassigned » podarok
Status: Needs work » Fixed

This is done

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

drupalnesia’s picture

Alternate module: https://www.drupal.org/project/path_alias_class

This module add classes automatically from website Path and Path Alias. Also you can add Custom CSS.
For example, if you have a node with title "Training" and NID is 77 then this module will automatically add these classes: training node-77.

This additional classes will help you easier to modify site appearance using CSS. Now you can styling the "training or node-77" page.