While using display suite in drupal 8.6.2 Is it possible to have a custom displaymode-html.html.twig that replaces the default html.html.twig?

So far I have tried enabling the view mode dev hints in themename.yml but it doesn't seem to be showing me anything for html.html.twig

  • what is your propose of having a custom html.twig file? this file is not meant to be used for design proposes much, just placement of page , page bottom, page top and placeholders Aug 24 at 7:18
  • The placement needs to vary, but only for certain display modes.
    – byte me
    Aug 25 at 1:53
  • You don't have any theming variables in this file , even you have no access to regions , so how placement might vary when you only have page top which must be before page, page and page button which should be placed after page? Aug 25 at 3:59
  • I think you should have use other theming files like page.html.twig not html.html.twig Aug 25 at 4:01
  • Thanks! Is there any documentation that would cover this?
    – byte me
    Aug 25 at 7:42

I'm not used to Display Suite but I'd recommend you to have a look at hook_theme_suggestions_alter() in order to build your own twig template suggestions based on specific conditions that you can set using the $variables variable values.

  • Thanks. I tried this with the hook set to html but it just shows me a blank in view mode.
    – byte me
    Aug 24 at 6:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.