Add (publish date): Change to datetime, show on view, save publishdate properly

add (composer): rss feed
This commit is contained in:
2023-07-31 00:21:18 +08:00
parent 3812976c0f
commit ad384c5fc2
44 changed files with 440 additions and 156 deletions

View File

@@ -42,32 +42,38 @@
<td><img width="80" height="60" src="{{ $post->featured_image }}"
class="img-fluid rounded-2" alt=""></td>
<td>
@if($post->status === 'publish')
<span class="badge bg-success">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'future')
<span class="badge bg-primary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'draft')
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'private')
<span class="badge bg-info">{{ ucfirst($post->status) }}</span>
@elseif ($post->status == 'trash')
<span class="badge bg-danger">{{ ucfirst($post->status) }}</span>
@else
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@endif
@if ($post->status === 'publish')
<span class="badge bg-success">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'future')
<span class="badge bg-primary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'draft')
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@elseif($post->status === 'private')
<span class="badge bg-info">{{ ucfirst($post->status) }}</span>
@elseif ($post->status == 'trash')
<span class="badge bg-danger">{{ ucfirst($post->status) }}</span>
@else
<span class="badge bg-secondary">{{ ucfirst($post->status) }}</span>
@endif
</td>
<td>
@if(!is_empty($post->post_category?->category?->country_locale_slug) && $post->status == 'publish')
<a
href="{{ route('home.country.post', ['country' => $post->post_category?->category?->country_locale_slug, 'post_slug' => $post->slug]) }}">{{ $post->title }}</a>
@if (!is_empty($post->post_category?->category?->country_locale_slug) && $post->status == 'publish')
<a
href="{{ route('home.country.post', ['country' => $post->post_category?->category?->country_locale_slug, 'post_slug' => $post->slug]) }}">{{ $post->title }}</a>
@else
{{ $post->title }}
{{ $post->title }}
@endif
</td>
<td>
Created at {{ $post->created_at->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}<br>
Updated {{ $post->updated_at->diffForhumans() }}
Created at
{{ $post->created_at->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}<br>
Updated {{ $post->updated_at->diffForhumans() }}<br>
@if ($post->status == 'publish')
Published at
{{ $post->publish_date->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}
@endif
</td>
<td>
<div><a href="{{ route('posts.manage.edit', ['post_id' => $post->id]) }}"

View File

@@ -5,23 +5,23 @@
<!-- Page title -->
<div class="page-header d-print-none">
<h2 class="page-title text-center justify-content-center">
<div class="align-self-center">
@if (!is_null($post))
Edit Post
@else
New Post
@endif
</div>
<div class="align-self-center">
@if (!is_null($post))
Edit Post
@else
New Post
@endif
</div>
</h2>
</div>
</div>
<div class="page-body">
<div class="container-xl">
@if (!is_null($post))
<post-editor :post-id="{{ $post->id }}"></post-editor>
@else
<post-editor></post-editor>
@endif
@if (!is_null($post))
<post-editor :post-id="{{ $post->id }}"></post-editor>
@else
<post-editor timezone="{{ session()->get('timezone') }}"></post-editor>
@endif
</div>
</div>
@endsection

View File

@@ -22,13 +22,14 @@
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"
class="text-decoration-none">
<div class="card-img-top ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}">
</div>
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</a>
@@ -85,13 +86,15 @@ class="text-decoration-none">{{ $post->title }}</a>
<a href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}"
class="text-decoration-none">
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}">
</div>
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}"
alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</a>
</div>

View File

@@ -44,15 +44,16 @@
</div>
<a class="card-img-top"
href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}">
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}">
</div>
</div>
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</a>
</div>

View File

@@ -43,15 +43,16 @@
</div>
<a class="card-img-top"
href="{{ route('home.country.post', ['country' => $country_locale->country_iso, 'post_slug' => $post->slug]) }}">
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}">
</div>
</div>
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</a>
</div>

View File

@@ -21,7 +21,13 @@
<span class="ms-2">
<small>
Written by {{ $post->author->name }}
{{ $post->author->name }}
</small>
</span>
<span class="ms-2">
<small>
{{ $post->publish_date->timezone(session()->get('timezone'))->isoFormat('Do MMMM YYYY, h:mm A') }}
</small>
</span>
</div>
@@ -31,15 +37,17 @@
<h2 class="h5">{{ $post->excerpt }}</h2>
</div>
<div class="mb-3">
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img class="img-fluid rounded-2" src="{{ $post->featured_image }}" alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen img-fluid rounded-2" src="{{ $post->featured_image_lqip }}" alt="Placeholder image of {{ $post->name }}">
</div>
</div>
<div class="img-fluid rounded-start ratio ratio-16x9">
<div class="lqip-loader">
<!-- Use the LQIP image with the appropriate URL -->
<img class="img-fluid rounded-2" src="{{ $post->featured_image }}"
alt="Photo of {{ $post->name }}">
<!-- Use the final JPEG image with the appropriate URL -->
<img class="lqip-frozen img-fluid rounded-2" src="{{ $post->featured_image_lqip }}"
alt="Placeholder image of {{ $post->name }}">
</div>
</div>
</div>
<div class="mb-3">
{!! $post->html_body !!}

View File

@@ -2,15 +2,15 @@
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
@include('googletagmanager::head')
@include('googletagmanager::head')
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
{!! SEOMeta::generate() !!}
{!! OpenGraph::generate() !!}
{!! Twitter::generate() !!}
{!! JsonLdMulti::generate() !!}
<meta property="fb:app_id" content="{{ config('seotools.fb_app_id') }}" />
{!! SEOMeta::generate() !!}
{!! OpenGraph::generate() !!}
{!! Twitter::generate() !!}
{!! JsonLdMulti::generate() !!}
<meta property="fb:app_id" content="{{ config('seotools.fb_app_id') }}" />
@vite('resources/sass/front-app.scss')

View File

@@ -4,26 +4,26 @@
<div class="col-6 col-md-2 mb-3">
<ul class="nav flex-column">
@foreach ($categories as $category)
@if ($category->id % 2 == 0)
<li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li>
@if ($category->id % 2 == 0)
<li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li>
@endif
@endforeach
@endforeach
</ul>
</div>
<div class="col-6 col-md-2 mb-3">
<ul class="nav flex-column">
@foreach ($categories as $category)
@if ($category->id % 2 == 1)
<li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li>
@if ($category->id % 2 == 1)
<li class="nav-item mb-2">
<a class="nav-link p-0 text-body-secondary"
href="{{ route('home.country.category', ['country' => $category->country_locale_slug, 'category' => $category->slug]) }}">{{ $category->name }}</a>
</li>
@endif
@endforeach
@endforeach
</ul>
</div>
@@ -51,7 +51,7 @@
</div>
@endif
{{-- <form>
{{-- <form>
<h5>Subscribe to our newsletter</h5>
<p>Monthly digest of what's new and exciting from us.</p>
<div class="d-flex flex-column flex-sm-row w-100 gap-2">

View File

@@ -1,4 +1,4 @@
@if($enabled)
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ $id }}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
@if ($enabled)
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id={{ $id }}" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
@endif

View File

@@ -1,16 +1,27 @@
@if($enabled)
<script>
window.dataLayer = window.dataLayer || [];
@unless(empty($dataLayer->toArray()))
window.dataLayer.push({!! $dataLayer->toJson() !!});
@endunless
@foreach($pushData as $item)
window.dataLayer.push({!! $item->toJson() !!});
@endforeach
</script>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ $id }}');</script>
@if ($enabled)
<script>
window.dataLayer = window.dataLayer || [];
@unless (empty($dataLayer->toArray()))
window.dataLayer.push({!! $dataLayer->toJson() !!});
@endunless
@foreach ($pushData as $item)
window.dataLayer.push({!! $item->toJson() !!});
@endforeach
</script>
<script>
(function(w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({
'gtm.start': new Date().getTime(),
event: 'gtm.js'
});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '{{ $id }}');
</script>
@endif