Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEATURE | Choose the html tag <h> to improve SEO #712

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions src/View/Components/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class Card extends Component

public function __construct(
public ?string $title = null,
public ?string $titleSEO = null,
public ?string $subtitle = null,
public ?string $subtitleSEO = null,
public ?bool $separator = false,
public ?bool $shadow = false,
public ?string $progressIndicator = null,
Expand Down Expand Up @@ -56,12 +58,54 @@ public function render(): View|Closure|string
<div>
@if($title)
<div @class(["text-2xl font-bold", is_string($title) ? '' : $title?->attributes->get('class') ]) >
{{ $title }}
@switch($titleSEO)
@case("h1")
<h1>{{ $title }}</h1>
@break
@case("h2")
<h2>{{ $title }}</h2>
@break
@case("h3")
<h3>{{ $title }}</h3>
@break
@case("h4")
<h4>{{ $title }}</h4>
@break
@case("h5")
<h5>{{ $title }}</h5>
@break
@case("h6")
<h6>{{ $title }}</h6>
@break
@default
{{ $title }}
@endswitch
</div>
@endif
@if($subtitle)
<div @class(["text-gray-500 text-sm mt-1", is_string($subtitle) ? '' : $subtitle?->attributes->get('class') ]) >
{{ $subtitle }}
@switch($subtitleSEO)
@case("h1")
<h1>{{ $subtitle }}</h1>
@break
@case("h2")
<h2>{{ $subtitle }}</h2>
@break
@case("h3")
<h3>{{ $subtitle }}</h3>
@break
@case("h4")
<h4>{{ $subtitle }}</h4>
@break
@case("h5")
<h5>{{ $subtitle }}</h5>
@break
@case("h6")
<h6>{{ $subtitle }}</h6>
@break
@default
{{ $subtitle }}
@endswitch
</div>
@endif
</div>
Expand Down