Skip to content

Commit 683a5a7

Browse files
committed
Fix #382: Unify the $page property
1 parent 3c80366 commit 683a5a7

8 files changed

+23
-21
lines changed

resources/views/components/post/article.blade.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
<article aria-label="Article" id="{{ Hyde::uriPath() ?? '' }}posts/{{ $post->slug }}" itemscope itemtype="https://schema.org/Article"
1+
<article aria-label="Article" id="{{ Hyde::uriPath() ?? '' }}posts/{{ $page->slug }}" itemscope itemtype="https://schema.org/Article"
22
@class(['post-article mx-auto prose dark:prose-invert', 'torchlight-enabled' => Hyde\Framework\Features::hasTorchlight()])>
3-
<meta itemprop="identifier" content="{{ $post->slug }}">
3+
<meta itemprop="identifier" content="{{ $page->slug }}">
44
@if(Hyde::uriPath())
5-
<meta itemprop="url" content="{{ Hyde::uriPath('posts/' . $post->slug) }}">
5+
<meta itemprop="url" content="{{ Hyde::uriPath('posts/' . $page->slug) }}">
66
@endif
77

88
<header aria-label="Header section" role="doc-pageheader">
99
<h1 itemprop="headline" class="mb-4">{{ $title ?? 'Blog Post' }}</h1>
1010
<div id="byline" aria-label="About the post" role="doc-introduction">
11-
@includeWhen(isset($post->date), 'hyde::components.post.date')
12-
@includeWhen(isset($post->author), 'hyde::components.post.author')
13-
@includeWhen(isset($post->category), 'hyde::components.post.category')
11+
@includeWhen(isset($page->date), 'hyde::components.post.date')
12+
@includeWhen(isset($page->author), 'hyde::components.post.author')
13+
@includeWhen(isset($page->category), 'hyde::components.post.category')
1414
</div>
1515
</header>
16-
@includeWhen(isset($post->image), 'hyde::components.post.image')
16+
@includeWhen(isset($page->image), 'hyde::components.post.image')
1717
<div aria-label="Article body" itemprop="articleBody">
1818
{!! $markdown !!}
1919
</div>
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
by author
22
<address itemprop="author" itemscope itemtype="https://schema.org/Person" aria-label="The post author" style="display: inline;">
3-
@if($post->author->website)
4-
<a href="{{ $post->author->website }}" rel="author" itemprop="url" aria-label="The author's website">
3+
@if($page->author->website)
4+
<a href="{{ $page->author->website }}" rel="author" itemprop="url" aria-label="The author's website">
55
@endif
6-
<span itemprop="name" aria-label="The author's name" {{ ($post->author->username && ($post->author->username !== $post->author->name)) ? 'title=@'. urlencode($post->author->username) .'' : '' }}>{{ $post->author->name ?? $post->author->username }}</span>
7-
@if($post->author->website)
6+
<span itemprop="name" aria-label="The author's name" {{ ($page->author->username && ($page->author->username !== $page->author->name)) ? 'title=@'. urlencode($page->author->username) .'' : '' }}>{{ $page->author->name ?? $page->author->username }}</span>
7+
@if($page->author->website)
88
</a>
99
@endif
1010
</address>
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
in the category "{{ $post->category }}"
1+
in the category "{{ $page->category }}"
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Posted <time itemprop="dateCreated datePublished" datetime="{{ $post->date->datetime }}" title="{{ $post->date->sentence }}">{{ $post->date->short }}</time>
1+
Posted <time itemprop="dateCreated datePublished" datetime="{{ $page->date->datetime }}" title="{{ $page->date->sentence }}">{{ $page->date->short }}</time>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<p itemprop="abstract">
2-
{{ $post->matter['description'] }}
2+
{{ $page->matter['description'] }}
33
</p>
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<figure aria-label="Cover image" role="doc-cover" itemprop="image" itemscope itemtype="https://schema.org/ImageObject">
2-
<img src="{{ $post->image->getSource() }}" alt="{{ $post->image->description ?? '' }}" title="{{ $post->image->title ?? '' }}" itemprop="image" class="mb-0">
2+
<img src="{{ $page->image->getSource() }}" alt="{{ $page->image->description ?? '' }}" title="{{ $page->image->title ?? '' }}" itemprop="image" class="mb-0">
33
<figcaption aria-label="Image caption" itemprop="caption">
4-
{!! $post->image->getFluentAttribution() !!}
4+
{!! $page->image->getFluentAttribution() !!}
55
</figcaption>
6-
@foreach ($post->image->getMetadataArray() as $name => $value)
6+
@foreach ($page->image->getMetadataArray() as $name => $value)
77
<meta itemprop="{{ $name }}" content="{{ $value }}">
88
@endforeach
99
</figure>

resources/views/layouts/post.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
@push('meta')
66
<!-- Blog Post Meta Tags -->
7-
@foreach ($post->getMetadata() as $name => $content)
7+
@foreach ($page->getMetadata() as $name => $content)
88
<meta name="{{ $name }}" content="{{ $content }}">
99
@endforeach
10-
@foreach ($post->getMetaProperties() as $name => $content)
10+
@foreach ($page->getMetaProperties() as $name => $content)
1111
<meta property="{{ $name }}" content="{{ $content }}">
1212
@endforeach
1313
@endpush

src/StaticPageBuilder.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ private function save(string $location, string $contents): bool|int
8686
private function compileView(): string
8787
{
8888
return view($this->page->view, [
89+
'page' => $this->page,
8990
'currentPage' => $this->page->view,
9091
])->render();
9192
}
@@ -98,7 +99,7 @@ private function compileView(): string
9899
private function compilePost(): string
99100
{
100101
return view('hyde::layouts/post')->with([
101-
'post' => $this->page,
102+
'page' => $this->page,
102103
'title' => $this->page->title,
103104
'markdown' => MarkdownConverter::parse($this->page->body),
104105
'currentPage' => 'posts/'.$this->page->slug,
@@ -113,6 +114,7 @@ private function compilePost(): string
113114
private function compilePage(): string
114115
{
115116
return view('hyde::layouts/page')->with([
117+
'page' => $this->page,
116118
'title' => $this->page->title,
117119
'markdown' => MarkdownConverter::parse($this->page->body),
118120
'currentPage' => $this->page->slug,
@@ -127,7 +129,7 @@ private function compilePage(): string
127129
private function compileDocs(): string
128130
{
129131
return view('hyde::layouts/docs')->with([
130-
'docs' => $this->page,
132+
'page' => $this->page,
131133
'title' => $this->page->title,
132134
'markdown' => MarkdownConverter::parse($this->page->body, DocumentationPage::class),
133135
'currentPage' => Hyde::docsDirectory().'/'.$this->page->slug,

0 commit comments

Comments
 (0)