Skip to content

Commit

Permalink
Restructure and format component, fix #306
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed May 11, 2022
1 parent 9be8783 commit 09d8af6
Showing 1 changed file with 24 additions and 19 deletions.
43 changes: 24 additions & 19 deletions resources/views/components/article-excerpt.blade.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,47 @@
@php
/** @var \Hyde\Framework\Models\MarkdownPost $post */
@endphp

<article class="mt-4 mb-8" itemscope itemtype="https://schema.org/Article">
<meta itemprop="identifier" content="{{ $post->slug }}">
@if(Hyde::uriPath())
@if(Hyde::uriPath())
<meta itemprop="url" content="{{ Hyde::uriPath('posts/' . $post->slug) }}">
@endif
@endif

<header>
<a href="posts/{{ $post->matter['slug'] }}.html" class="block w-fit">
<a href="posts/{{ $post->slug }}.html" class="block w-fit">
<h2 class="text-2xl font-bold text-gray-700 hover:text-gray-900 dark:text-gray-200 dark:hover:text-white transition-colors duration-75">
{{ $post->matter['title'] ?? $post->title }}
</h2>
</a>
</header>

<footer>
@isset($post->matter['date'])
@isset($post->matter['date'])
<span class="opacity-75">
<span itemprop="dateCreated datePublished">
{{ date('M jS, Y', strtotime($post->matter['date'])) }}</span>{{ isset($post->matter['author']) ? ',' : '' }}
</span>
@endisset
@isset($post->matter['author'])
@endisset
@isset($post->author)
<span itemprop="author" itemscope itemtype="https://schema.org/Person">
<span class="opacity-75">by</span>
<span itemprop="name">
{{ $post->matter['author'] }}
{{ $post->author->name ?? $post->author->username }}
</span>
</span>
@endisset
@endisset
</footer>

<div>
@isset($post->matter['description'])
<section role="doc-abstract" aria-label="Excerpt">
<p class="leading-relaxed my-1">
{{ $post->matter['description'] }}
</p>
</section>
@endisset
<a href="posts/{{ $post->matter['slug'] }}.html" class="text-indigo-500 hover:underline font-medium">Read post</a>
</div>
@isset($post->matter['description'])
<section role="doc-abstract" aria-label="Excerpt">
<p class="leading-relaxed my-1">
{{ $post->matter['description'] }}
</p>
</section>
@endisset

<footer>
<a href="posts/{{ $post->slug }}.html" class="text-indigo-500 hover:underline font-medium">Read post</a>
</footer>
</article>

0 comments on commit 09d8af6

Please sign in to comment.