Last active
August 8, 2025 16:53
-
-
Save wallacemaxters/10827c6005c9d1f63db56b995094fd1e to your computer and use it in GitHub Desktop.
Templates prédefinidos para utilizar em um novo projeto Laravel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="pt-br" @class(['text-xs xl:text-[0.8rem] 2xl:text-[1.1rem] leading-normal h-full scroll-smooth', $htmlClass])> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>{{ $title ? sprintf('%s | %s', $title, config('app.name')) : config('app.name') }}</title> | |
<link rel="icon" type="image/x-icon" href="{{ asset('static/img/favicon.ico') }}"> | |
<!-- SEO --> | |
<link rel="canonical" href="{{ $canonical }}"> | |
<meta property="og:title" content="{{ $title ? sprintf('%s | %s', $title, config('app.name')) : config('app.name') }}"> | |
<meta property="og:url" content="{{ $canonical }}"> | |
<meta property="og:type" content="website"> | |
<meta property="og:description" content="{{ $description }}"> | |
@if($image) | |
<meta property="og:image" content="{{ $image }}"> | |
@endif | |
<meta name="description" content="{{ str($description)->limit(170) }}"> | |
<meta name="theme-color" content="#11234E" /> | |
@if($gtmId) | |
<!-- Google Tag Manager --> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer', @js($gtmId));</script> | |
<!-- End Google Tag Manager --> | |
@endif | |
<link rel="preconnect" href="https://fonts.googleapis.com"> | |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> | |
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet"> | |
<!-- /SEO --> | |
@vite(['resources/css/app.css', 'resources/js/app.js']) | |
{{ $head ?? '' }} | |
@livewireStyles | |
</head> | |
<body @class(['antialiased min-h-full flex flex-col w-full font-light', $bodyClass])}}"> | |
@if($gtmId) | |
<!-- Google Tag Manager (noscript) --> | |
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ $gtmId }}" | |
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
<!-- End Google Tag Manager (noscript) --> | |
@endif | |
{{ $slot }} | |
@livewireScriptConfig | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\View\Components\Layouts; | |
use Closure; | |
use Illuminate\Contracts\View\View; | |
use Illuminate\View\Component; | |
class Base extends Component | |
{ | |
public ?string $gtmId = null; | |
/** | |
* Create a new component instance. | |
*/ | |
public function __construct( | |
public readonly ?string $bodyClass = null, | |
public readonly ?string $htmlClass = null, | |
public readonly ?string $head = null, | |
public readonly ?string $title = null, | |
public ?string $canonical = null, | |
public readonly ?string $description = null, | |
public readonly ?string $image = null, | |
public bool $dark = false, | |
) | |
{ | |
$this->canonical ??= url()->current(); | |
$this->gtmId = config('site.google_tag_manager'); | |
} | |
/** | |
* Get the view / contents that represent the component. | |
*/ | |
public function render(): View|Closure|string | |
{ | |
return view('components.layouts.base'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Utilização:
Coloque o arquivo dentro da pasta
resources/views/components
do seu projeto Laravel.Em seguida, chame na sua view.