Skip to content

Commit

Permalink
Update the views to move logic to data layer
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Apr 19, 2022
1 parent 648bc31 commit 2ebc62c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
4 changes: 2 additions & 2 deletions resources/views/components/post/article.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<h1 itemprop="headline" class="mb-4">{{ $title ?? 'Blog Post' }}</h1>
<div id="byline" aria-label="About the post" role="doc-introduction">
@includeWhen($post->date, 'hyde::components.post.date')
@includeWhen($author, 'hyde::components.post.author')
@includeWhen($category, 'hyde::components.post.category')
@includeWhen($post->author, 'hyde::components.post.author')
@includeWhen($post->category, 'hyde::components.post.category')
</div>
</header>
@includeWhen(isset($post->image), 'hyde::components.post.image')
Expand Down
11 changes: 4 additions & 7 deletions resources/views/components/post/author.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
@php
$authorObject = Hyde\Framework\Services\AuthorService::find($author);
@endphp
by author
<address itemprop="author" itemscope itemtype="https://schema.org/Person" aria-label="The post author" style="display: inline;">
@if($authorObject && $authorObject->website)
<a href="{{ $authorObject->website }}" rel="author" itemprop="url" aria-label="The author's website">
@if($post->author->website)
<a href="{{ $post->author->website }}" rel="author" itemprop="url" aria-label="The author's website">
@endif
<span itemprop="name" aria-label="The author's name" {{ $authorObject && $authorObject->username ? 'title=@'.$authorObject->username.'' : '' }}>{{ $authorObject->name ?? $author }}</span>
@if($authorObject && $authorObject->website)
<span itemprop="name" aria-label="The author's name" {{ $post->author->username ? 'title=@'.$post->author->username.'' : '' }}>{{ $post->author->name ?? $post->author->username }}</span>
@if($post->author->website)
</a>
@endif
</address>
2 changes: 1 addition & 1 deletion resources/views/components/post/category.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
in the category "{{ $category }}"
in the category "{{ $post->category }}"
7 changes: 0 additions & 7 deletions resources/views/layouts/post.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
@extends('hyde::layouts.app')
@section('content')

@php
$title = $post->matter['title'] ?? false;
$description = $post->matter['description'] ?? false;
$category = $post->matter['category'] ?? false;
$author = $post->matter['author'] ?? false;
@endphp

@push('meta')
<!-- Blog Post Meta Tags -->
@foreach ($post->getMetadata() as $name => $content)
Expand Down

0 comments on commit 2ebc62c

Please sign in to comment.