@extends('layouts.app') @section('title', $article->title . ' | Homeland News') @section('meta_description', \Illuminate\Support\Str::limit(strip_tags($article->excerpt ?: strip_tags($article->body)), 160)) @section('canonical', route('articles.show', $article->slug)) @section('og_type', 'article') @section('og_title', $article->title) @section('og_description', \Illuminate\Support\Str::limit(strip_tags($article->excerpt ?: strip_tags($article->body)), 200)) @section('og_image', ($article->image_url && !preg_match('/^https?:\/\//i', $article->image_url)) ? asset(ltrim($article->image_url,'/')) : ($article->image_url ?: asset('images/homeland_logo.png'))) @section('twitter_title', $article->title) @section('twitter_description', \Illuminate\Support\Str::limit(strip_tags($article->excerpt ?: strip_tags($article->body)), 200)) @push('head') @endpush @section('content')
@php $img = $article->image_url ? (preg_match('/^https?:\/\//i',$article->image_url) ? $article->image_url : asset(ltrim($article->image_url,'/'))) : null; $author = optional($article->author)->name; $url = request()->fullUrl(); $encodedUrl = urlencode($url); $encodedTitle = urlencode($article->title); @endphp

{{ $article->title }}

{{ $author ? 'By ' . $author : 'By Unknown' }} · {{ optional($article->published_at)->format('M j, Y') }} @if($article->categories && $article->categories->isNotEmpty()) · {{ $article->categories->pluck('name')->take(2)->join(', ') }} @endif
@if($img)
{{ $article->title }}
@endif {{-- Media players --}} @php $audio = $article->audio_source; $video = $article->video_source; $isYouTube = $video && preg_match('~^(https?:)?//(www\.)?(youtube\.com|youtu\.be)/~i', $video); $isVimeo = $video && preg_match('~^(https?:)?//(www\.)?vimeo\.com/~i', $video); @endphp @if($audio)

Listen to this article

@endif @if($video)
@if($isYouTube) @php // Convert to embed URL $embed = $video; if (preg_match("~youtu\.be/([\w-]+)~", $video, $m)) { $embed = 'https://www.youtube.com/embed/' . $m[1]; } elseif (preg_match("~v=([\w-]+)~", $video, $m)) { $embed = 'https://www.youtube.com/embed/' . $m[1]; } @endphp
@elseif($isVimeo) @php $embed = $video; if (preg_match("~vimeo\.com/(?:video/)?(\d+)~", $video, $m)) { $embed = 'https://player.vimeo.com/video/' . $m[1]; } @endphp
@else @endif
@endif {{-- Article Inline Ad --}} @include('partials.ad-slot', ['placement' => 'article-inline'])
{!! $article->body !!}
@if(($related ?? collect())->isNotEmpty())

You may also like

@foreach($related as $rel) @php $rimg = $rel->image_url ? (preg_match('/^https?:\/\//i',$rel->image_url) ? $rel->image_url : asset(ltrim($rel->image_url,'/'))) : 'https://via.placeholder.com/480x270'; @endphp @endforeach
@endif

Comments

@if(($approvedComments ?? collect())->isEmpty())

No comments yet.

@else
    @foreach($approvedComments as $c)
  • {{ optional($c->user)->name ?? 'User' }} · {{ $c->created_at->diffForHumans() }}
    {{ $c->body }}
  • @endforeach
@endif
@if(session('status'))
{{ session('status') }}
@endif @if($errors->has('auth'))
{{ $errors->first('auth') }}
@endif

Add a comment

@auth
@csrf
@error('body')

{{ $message }}

@enderror
@else

Please log in or create an account to add a comment.

@endauth
@endsection