0

I recently logged out of my Drupal 8 site to see the pages not obscured by the admin menu.

I then logged back in (/user/login) and, to my surprise, it sent me to /user/1.

When I tried to click the "Go To Site" link - it sends me BACK to /user/1.

I did nothing out of the ordinary except log out.

How do I get my Back To Site button to point to the correct location (mydomain.com/) again?

3

You're just stating facts, that is how Drupal works. If you log in, you go to your profile site by default. That might not make sense for most sites, but that's what it does by default, there modules that allow you to change it.

And "Back to Site" takes you back you the last non-admin page you were on. If you are on the homepage, it will point you back to that. Again, that's a feature, not a bug

|improve this answer|||||
  • Exactly. The new Drupal 8 toolbar includes a contextually aware “back to site” button that serves the same use-case as overlay by allowing site users to return from the admin context to the page that they were on. – Wim Mostrey Jan 11 '17 at 20:25
  • So a user page is not considered an admin page? – Thomas G Jan 11 '17 at 20:25
  • 2
    Not sure about the exact implementation there, but non-admin is basically everything except urls starting with /admin. Usually in Drupal, it is a bit more complex than that, you can mark routes as admin/non-admin to override that, but since this link is AFAIK simply done with client-side JS based on your browser history, I doubt it cares about that. So no, user/1 is not an admin page, it's your profile page, which is public assuming you set the permission accordingly. – Berdir Jan 11 '17 at 20:34
0

This is very confusing, even for people that knows Drupal. The problem is with usability. You wouldn't expect that the same button will take you to different places. Sometimes it take you to the home, some times to your user profile.

To avoid frustrations, I'm removing it from my projects using the following code on a custom module:

/**
 * Implements hook_toolbar_alter().
 */
function mymodulename_toolbar_alter(&$items) {
  // Remove the "Back to site" button from toolbar because it has a confusing logic.
  unset($items['home']);
}
|improve this answer|||||

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.