I put blocks which use jQuery in the body of one (and only one) cshtml file which uses the template and they causes error because jQuery is not loade
You can use sections :
in your layout :
... @RenderSection("scripts", required: false) ...
in yours cshtml :
@section scripts { }