How do I show a link to the user registration page only to anonymous users? I want to show anonymous users a "Register" link.

So, in mymodule.menu.yml:

mymodule.userregister:
  title: 'Register an Account'
  url: 'internal:/user/register'
  weight: 10
  menu_name: account


This adds a register link to the account menu next to the login/logout link-- great!  Except it also shows up for authenticated users, who get an "access denied" error if they click it.

I looked in user.links.menu.yml in code/modules/user to try to find something I could use:

user.page:
  title: 'My account'
  weight: -10
  route_name: user.page
  menu_name: account
user.logout:
  weight: 10
  menu_name: account
  class: Drupal\user\Plugin\Menu\LoginLogoutMenuLink


I also checked user.routing.yml:

user.register:
  path: '/user/register'
  defaults:
    _entity_form: 'user.register'
    _title: 'Create new account'
  requirements:
    _access_user_register: 'TRUE'

user.logout:
  path: '/user/logout'
  defaults:
    _controller: '\Drupal\user\Controller\UserController::logout'
  requirements:
    _user_is_logged_in: 'TRUE'


I'm stumped.  How can I make my menu link only show up for anonymous users?
According to Structure of routes


  _role: A specific Drupal role, eg. 'administrator'. You can specify multiple ones via "," for AND and "+" for OR logic. Note that, since
  the roles available may differ between sites, it's recommended to use
  permission based access restriction when possible.


so try 

requirements:
  _role: anonymous