Update (layout): add favicon, improve home pages, add noindex if page is empty

This commit is contained in:
2023-08-02 01:16:55 +08:00
parent 2ddc91a0c6
commit 6a37294e9b
11 changed files with 143 additions and 103 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -63,6 +63,10 @@ public function country(Request $request, $country)
->take(10)
->get();
if ($latest_posts->count() <= 0) {
SEOMeta::setRobots('noindex');
}
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
@@ -94,6 +98,8 @@ public function countryCategory(Request $request, $country, $category)
abort(404);
}
$request->session()->put('view_country_locale', $country_locale);
$latest_posts = Post::with('post_categories')->select('posts.*')
->join('post_categories', 'posts.id', '=', 'post_categories.post_id')
->join('categories', 'post_categories.category_id', '=', 'categories.id')
@@ -106,6 +112,10 @@ public function countryCategory(Request $request, $country, $category)
->distinct()
->paginate(15);
if ($latest_posts->count() <= 0) {
SEOMeta::setRobots('noindex');
}
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
@@ -126,6 +136,8 @@ public function all(Request $request, $country)
{
$country_locale = CountryLocale::where('slug', $country)->first();
$request->session()->put('view_country_locale', $country_locale);
$latest_posts = Post::with('post_categories')->select('posts.*')
->join('post_categories', 'posts.id', '=', 'post_categories.post_id')
->join('categories', 'post_categories.category_id', '=', 'categories.id')
@@ -137,6 +149,10 @@ public function all(Request $request, $country)
->distinct()
->paginate(15);
if ($latest_posts->count() <= 0) {
SEOMeta::setRobots('noindex');
}
SEOTools::metatags();
SEOTools::twitter();
SEOTools::opengraph();
@@ -157,6 +173,8 @@ public function post(Request $request, $country, $post_slug)
if (! is_null($post)) {
$request->session()->put('view_country_locale', $post->post_category->category->country_locale);
SEOMeta::setTitle($post->title);
SEOMeta::setDescription($post->excerpt);
SEOMeta::addMeta('article:published_time', $post->publish_date, 'property');

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 15 KiB

1
public/site.webmanifest Normal file
View File

@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

View File

@@ -11,6 +11,7 @@
</div>
</div>
</div>
@if ($featured_posts->count() > 0)
<div class="container-fluid py-4 bg-dark text-light">
<div class="container">
<h3 class="h4 fw-bold text-center mb-3">Featured Articles</h3>
@@ -71,6 +72,9 @@ class="text-body-secondary">{{ $post->publish_date->format('j F Y') }}</small>
</div>
</div>
</div>
@endif
@if (count($latest_posts) > 0)
<div class="container-fluid py-4">
<div class="container">
<div class="row justify-content-center">
@@ -133,11 +137,22 @@ class="text-body-secondary">{{ $post->publish_date->format('j F Y') }}</small>
</div>
<div class="text-center py-3">
@if ($country_locale->country_iso != '*')
<a href="{{ route('home.country.posts', ['country' => $country_locale->country_iso]) }}"
class="btn btn-primary">All News & Updates</a>
@else
<a href="{{ route('home.country.posts', ['country' => 'world']) }}"
class="btn btn-primary">All News & Updates</a>
@endif
</div>
</div>
</div>
</div>
</div>
@else
<div class="container text-center pb-5">
Oops! Nothing much here yet. Stay tuned!
</div>
@endif
@endsection

View File

@@ -14,6 +14,12 @@
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="apple-touch-icon" sizes="180x180" href="apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="favicon-16x16.png">
<link rel="manifest" href="site.webmanifest">
@vite('resources/sass/front-app.scss')
<!-- Custom styles for this Page-->