I have a basic layout for a Drupal 8 site, created two blocks with block 1 containing menu with static content and links to pages, and block 2 for subscription form, The block 1 and block 2 are called on specific pages/nodes. for the menu subscribe in block 1, I gave the anchor link to the block 2 with an id (#subcription), since the block 1 and block 2 are called on specific pages, if the user is on home page and clicks on the subscribe menu it anchors to the home page block 2 which is fine, however when a user is on page 1 or page 2 and clicks on the subscribe menu the block does not anchor to the same page but directed to the homepage block 2 instead, how do we get the block 2 to anchor on the same page the user is in?
1 Answer
You can anchor to a part of a page by entering just the ID into the menu item Link, without the initial /
:
#subscription
This link will always jump within the current page, unless there is no such element in it, then it does nothing.