Score:0

How to make a vertical menu properly?

id flag

Good morning all,

Today I would like to ask a simple question about the menus. How do you make a clean sidebar that takes up the entire length of the page? In general, the themes offer only natively horizontal menus that occupy the entire width.

To have a sidebar, you must put the menu in a block side position and make the necessary adjustments with CSS?

Score:3
de flag

Yes, theme regions and CSS are what you need. Basically, from admin/structure/block you place your menu block into one of your theme's region. And then, with CSS you adjust the style of the region to your needs.

If the HTML structure does not match your needs, you can also alter the page template of your theme (page.html.twig file). If this file does not exist in your theme, just copy it from \core\themes\classy\templates\layout\page.html.twig to themes\yourtheme\templates\optionalsubfolder\page.html.twig). This file allows you to modify the HTML structure of your page and consequently, the position of your page regions within the HTML.

e.g. If I place my Menu Block into "Sidebar first" region, I know that {{ page.sidebar_first }} twig variable is the one that contains the display of the menu.

sonfd avatar
in flag
I'd recommend copying templates from your base theme, if you have one, instead of classy.
hotwebmatter avatar
nr flag
@sonfd I agree. Classy subthemes are relatively advanced. Subtheming Classy does have advantages, such as complete control over theming. It’s a lot more work though, and you need to know what you’re doing.
misterdidi avatar
de flag
@sonfd, you're right. As a matter of fact, I'd recommend using Twig debugging to spot which template files are being used and may be overriden if necessary.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.