Skip to content

Commit

Permalink
Move all head tags into blade component
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 5, 2022
1 parent a61db68 commit 3093ebf
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
31 changes: 1 addition & 30 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
@@ -1,32 +1,7 @@
<!DOCTYPE html>
<html lang="{{ config('hyde.language', 'en') }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:site_name" content="{{ config('hyde.name', 'HydePHP') }}">
<title>{{ isset($title) ? config('hyde.name', 'HydePHP') . ' - ' . $title : config('hyde.name', 'HydePHP') }}</title>

@if (file_exists(Hyde::path('_media/favicon.ico')))
<link rel="shortcut icon" href="{{ Hyde::relativePath('media/favicon.ico', $currentPage) }}" type="image/x-icon">
@endif

{{-- Config Defined Tags --}}
@foreach (config('hyde.meta', []) as $name => $content)
<meta name="{{ $name }}" content="{{ $content }}">
@endforeach

@stack('meta')

{{-- App Stylesheets --}}
@include('hyde::layouts.styles')

{{-- Include any extra tags to include in the <head> section --}}
@include('hyde::layouts.meta')

@if(Hyde::features('darkmode'))
{{-- Check the local storage for theme preference to avoid FOUC --}}
<script>if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark') } </script>
@endif
@include('hyde::layouts.head')
</head>
<body id="app" class="flex flex-col min-h-screen overflow-x-hidden dark:bg-gray-900 dark:text-white">
<a href="#content" id="skip-to-content">Skip to content</a>
Expand All @@ -38,10 +13,6 @@

@includeUnless(config('hyde.footer.enabled', true) && ($withoutNavigation ?? false), 'hyde::layouts.footer')

{{-- App Scripts --}}
@include('hyde::layouts.scripts')

{{-- Include any extra scripts to include before the closing <body> tag --}}
@stack('scripts')
</body>
</html>
26 changes: 26 additions & 0 deletions resources/views/layouts/head.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:site_name" content="{{ config('hyde.name', 'HydePHP') }}">
<title>{{ isset($title) ? config('hyde.name', 'HydePHP') . ' - ' . $title : config('hyde.name', 'HydePHP') }}</title>

@if (file_exists(Hyde::path('_media/favicon.ico')))
<link rel="shortcut icon" href="{{ Hyde::relativePath('media/favicon.ico', $currentPage) }}" type="image/x-icon">
@endif

{{-- Config Defined Tags --}}
@foreach (config('hyde.meta', []) as $name => $content)
<meta name="{{ $name }}" content="{{ $content }}">
@endforeach

@stack('meta')

{{-- App Stylesheets --}}
@include('hyde::layouts.styles')

{{-- Include any extra tags to include in the <head> section --}}
@include('hyde::layouts.meta')

@if(Hyde::features('darkmode'))
{{-- Check the local storage for theme preference to avoid FOUC --}}
<script>if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark'); } else { document.documentElement.classList.remove('dark') } </script>
@endif
3 changes: 3 additions & 0 deletions resources/views/layouts/scripts.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
@if(Hyde::assetManager()->hasMediaFile('app.js'))
<script defer src="{{ Hyde::relativeLink('media/app.js', $currentPage) }}"></script>
@endif

{{-- Include any extra scripts to include before the closing <body> tag --}}
@stack('scripts')

0 comments on commit 3093ebf

Please sign in to comment.