<script>
    jQuery(window).load(function(){
        jQuery('#modal{{modalid}}').modal('show');
        jQuery('#modal{{modalid}}Button').click(function() {
          {% if url is not empty %}
            document.cookie = "redirectOnce={{ url|raw }}";
          {% endif %}
            history.replaceState(null, "{{title}}", "{{login_url}}");
            window.location.href = '{{login_url|raw }}';
        });
    });
 </script>
 
 <div class="modal fade in" id="modal{{modalid}}" tabindex="-1" role="dialog" aria-labelledby="modal{{modalid}}Label" aria-hidden="true"  data-backdrop="static" data-keyboard="false">
   <div class="modal-dialog modal-dialog-centered" role="document">
     <div class="modal-content">
       <div class="modal-header">
         <h2 class="modal-title" id="modal{{modalid}}Label"><i class="fas fa-info-circle"></i> Login benötigt</h2>
       </div>
       <div class="modal-body">
            Sie müssen sich zuerst anmelden, um diese Seite sehen zu können.
       </div>
       <div class="modal-footer">
         <button id="modal{{modalid}}Button" type="button" class="btn btn-primary" data-dismiss="modal">Zum Login</button>
       </div>
     </div>
   </div>
 </div>