Skip to content
This repository has been archived by the owner on May 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from raulg/master
Browse files Browse the repository at this point in the history
Missing field fixes
  • Loading branch information
levimykel authored Jan 29, 2019
2 parents dc6f875 + dfa4208 commit 453c224
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
);

// If there is no bloghome content, display 404 page
if ( $bloghomeContent == null ) {
if (!$bloghomeContent || $bloghomeContent->data == new stdClass()) {
not_found($app);
return;
}
Expand Down
6 changes: 3 additions & 3 deletions app/views/bloghome.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
$title = RichText::asText($bloghome->data->headline);
$isBloghome = true;

$imageUrl = $bloghome->data->image->url;
$imageUrl = !$bloghome->data->image ? $bloghome->data->image->url : '';
$linkResolver = $prismic->linkResolver;

?>
Expand All @@ -29,13 +29,13 @@
<div class="blog-post" data-wio-id=<?= $post->id ?>>
<h2>
<a href="<?= $linkResolver->resolve($post) ?>">
<?= RichText::asHtml($post->data->title, $linkResolver) ?>
<?= $post->data->title ? RichText::asHtml($post->data->title, $linkResolver) : '<h1>Untitled</h1>' ?>
</a>
</h2>

<p class="blog-post-meta">
<time class="created-at">
<?= Date::asDate($post->data->date)->format('M d, Y'); ?>
<?= $post->data->date ? Date::asDate($post->data->date)->format('M d, Y') : '' ?>
</time>
</p>

Expand Down
2 changes: 1 addition & 1 deletion app/views/slices/image.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

$imageWithCaption = $slice->primary;

$imageUrl = $imageWithCaption->image->url;
$imageUrl = !$imageWithCaption->image ? $imageWithCaption->image->url : '';
$caption = $imageWithCaption->caption;

switch ( $slice->slice_label ) {
Expand Down
2 changes: 1 addition & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 453c224

Please sign in to comment.