<!doctype html>
<html lang="de">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no">

    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <link rel="stylesheet" href="{{asset('template/css/app.css')}}">


    @yield('stylesheet')

    @if(isset($title))
        <title>{{$title}}</title>
    @else
        <title>{{ \Setting::get('name')}}</title>
    @endif

    @if(isset($description))
        <meta name="description" content="{{$description}}">
    @else
        <meta name="description" content="">
    @endif

    <link rel="manifest" href="/site.webmanifest">
    <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
    <meta name="msapplication-TileColor" content="#603cba">
    <meta name="theme-color" content="#6c23d7">

    @if (\Route::currentRouteName() == 'nachrichten.get')
        <meta name="description" content="{{ strip_tags(\Str::limit($nach->nachrichten, 285, ' ...')) }}">
        <meta property="article:published_time" content="{{ $nach->created_at->format('c') }}">
        <meta property="og:title" content="{{ $nach->title }}" />
        <meta property="og:description" content="{{ strip_tags(\Str::limit($nach->nachrichten, 285, ' ...')) }}" />
        <meta property="og:url" content="{{ \Request::url() }}" />
        <meta property="og:type" content="article" />
        <meta property="og:site_name" content="{{ isset($title) ? $title : \Setting::get('name') }}" />

        @if ($nach->image)
            <meta property="og:image" content="{{ asset('uploads/' . $nach->image) }}" />
            <meta property="twitter:image" content="{{ asset('uploads/' . $nach->image) }}" />
        @else
            @if ($nach->category->image)
                <meta property="og:image" content="{{ asset('uploads/categories/' . $nach->category->image) }}" />
                <meta property="twitter:image" content="{{ asset('uploads/categories/' . $nach->category->image) }}" />
            @else
                <meta property="og:image" content="{{ \Setting::get('image') }}" />
                <meta property="twitter:image" content="{{ \Setting::get('image') }}" />
            @endif
        @endif
    @endif

    @switch(\Setting::get('css', 1))
        @case(1)
            <!-- Default -->
        @break

        @case(2)
            <!-- Blue -->
        @break

        @case(3)
            <!-- Green -->
        @break

        @case(4)
            <!-- Dark -->
        @break
    @endswitch

    @if(App::environment('production'))


        @if (!empty(\Setting::get('facebook', '')))


            <script>
                !function(f,b,e,v,n,t,s)
                {if(f.fbq)return;n=f.fbq=function(){n.callMethod?
                    n.callMethod.apply(n,arguments):n.queue.push(arguments)};
                    if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
                    n.queue=[];t=b.createElement(e);t.async=!0;
                    t.src=v;s=b.getElementsByTagName(e)[0];
                    s.parentNode.insertBefore(t,s)}(window, document,'script',
                    'https://connect.facebook.net/en_US/fbevents.js');
                fbq('init', '{{\Setting::get('facebook') }}');
                fbq('track', 'PageView');
            </script>
            <noscript><img height="1" width="1" style="display:none"
                           src="https://www.facebook.com/tr?id={{\Setting::get('facebook') }}&ev=PageView&noscript=1"
                /></noscript>

        @endif

        @if (!empty(\Setting::get('analytics', '')))

            <script async src="https://www.googletagmanager.com/gtag/js?id={{\Setting::get('analytics') }}"></script>
            <script>
                window.dataLayer = window.dataLayer || [];
                function gtag(){dataLayer.push(arguments);}
                gtag('js', new Date());

                gtag('config', '{{\Setting::get('analytics') }}');
            </script>
        @endif

    @endif

    <link href="{{asset('template/css/toastr.min.css')}}" rel="stylesheet"/>

    @if (!empty(\Setting::get('favicon_image', '')))
        <link rel="apple-touch-icon" sizes="180x180" href="{{ asset('uploads/' . \Setting::get('favicon_image', '')) }}">
        <link rel="icon" type="image/png" sizes="32x32" href="{{ asset('uploads/' . \Setting::get('favicon_image', '')) }}">
        <link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/' . \Setting::get('favicon_image', '')) }}">
    @endif

    @yield('styles')
</head>
<body>