Skip to content

Instantly share code, notes, and snippets.

@wallacemaxters
Created September 28, 2023 14:46
Show Gist options
  • Save wallacemaxters/10827c6005c9d1f63db56b995094fd1e to your computer and use it in GitHub Desktop.
Save wallacemaxters/10827c6005c9d1f63db56b995094fd1e to your computer and use it in GitHub Desktop.
Templates prédefinidos para utilizar em um novo projeto Laravel
@props([
'bodyClass' => null,
'htmlClass' => '2xl:text-base lg:text-sm text-sm leading-normal',
'head' => null,
'title' => null,
'canonical' => url()->current(),
'description' => null,
'image' => null,
])
<!DOCTYPE html>
<html lang="pt-br" @class($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>
<!-- SEO -->
<link rel="canonical" href="{{ $canonical }}">
<meta property="og:title" content="{{ $title }}">
<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) }}">
<!-- /SEO -->
{{ $head ?? '' }}
</head>
<body @class($bodyClass)>
{{ $slot }}
</body>
</html>
@wallacemaxters
Copy link
Author

wallacemaxters commented Sep 28, 2023

Utilização:

Coloque o arquivo dentro da pasta resources/views/components do seu projeto Laravel.

Em seguida, chame na sua view.

<x-layouts.base  
    title="Jesus é o Senhor" 
    :image="Vite::image('resources/image/jesus.png')" 
    description="Quem crê nele tem a vida eterna">

    <x-slot:head>
         <script src="/app.js"></script>
    </x-slot>

    <p>O céu se alegra quando um pecador se arrepende</p>
</x-layouts.base>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment