Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v10.0.0 #26

Merged
merged 13 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
APP_AUTHOR="musimana"
APP_COPYRIGHT="MIT (2024)"
APP_DESCRIPTION="Laravel VILT stack template app with server-side rendering (SSR), Larastan, Pest & Dusk test suites. Created by Musimana."
APP_IMAGE_OPEN_GRAPH="resources/img/open-graph.png"
#APP_KEYWORDS="Musimana, Bassform, Laravel, VILT"
APP_LINK_PROJECT_REPO="https://github.com/musimana/bassform"

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Bassform - VILT SSR

![Bassform - VILT SSR](resources/img/banner-readme.png)

VILT stack template app for PHP 8.2.x created by Musimana. Features include server-side rendering (SSR) and Larastan, Pest & Dusk test suites.

[Vue3](https://vuejs.org/),
Expand Down
4 changes: 3 additions & 1 deletion app/Http/Controllers/Public/HomepageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use App\Http\Controllers\Controller;
use App\Http\Resources\Views\Public\Content\HomepageContentResource;
use App\Http\Resources\Views\Public\Metadata\HomepageMetadataResource;
use App\Repositories\Views\PublicViewRepository;
use Inertia\Response;

Expand All @@ -16,7 +17,8 @@ public function __invoke(): Response
{
return (new PublicViewRepository)->getViewDetails(
self::TEMPLATE_PUBLIC_INDEX,
(new HomepageContentResource)->getItem()
(new HomepageContentResource)->getItem(),
(new HomepageMetadataResource)->getItem()
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Http\Resources\Views\Public\Metadata;

use App\Interfaces\Resources\Items\ConstantItemInterface;
use Illuminate\Support\Facades\Vite;

final class HomepageMetadataResource implements ConstantItemInterface
{
/**
* Get the metadata array for the site homepage.
*
* @return array<string, string>
*/
public function getItem(): array
{
return [
'openGraphImage' => Vite::asset(config('metadata.open_graph_image')),
];
}
}
17 changes: 17 additions & 0 deletions config/metadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,23 @@

'description' => env('APP_DESCRIPTION', ''),

/*
|--------------------------------------------------------------------------
| Open Graph Image
|--------------------------------------------------------------------------
|
| The string for the filename of the image to be used for the app's
| Open Graph image. Should be in the resources/images directory, so it's
| included in Vite's asset bundling.
|
| Max size: 8MB, 1200px x 630px.
| [Open Graph Docs](https://ogp.me/)
| [Good Blog](https://kaydee.net/blog/open-graph-image/)
|
*/

'open_graph_image' => env('APP_IMAGE_OPEN_GRAPH'),

/*
|--------------------------------------------------------------------------
| Social Media Links
Expand Down
Binary file added resources/img/banner-readme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/img/open-graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions resources/js/Components/Icons/IconAppLogo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
stroke="currentColor"
stroke-width="1"
>
<circle cx="512" cy="512" r="496" stroke-width="32" fill="none" />
<circle cx="512" cy="512" r="496" stroke-width="32" fill="none" stroke-linecap="round" stroke-linejoin="round" />
<polygon points="488,128 896,203 536,188 536,248 848,302 536,293 536,674 491,680" />
<circle cx="332" cy="680" r="180" stroke-width="48" fill="none" />
<circle cx="332" cy="680" r="180" stroke-width="48" fill="none" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</template>
10 changes: 5 additions & 5 deletions resources/js/Components/Sections/AppHead.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ defineProps({
<meta v-if="metadata?.canonical && metadata.canonical !== ''" name="canonical" :content="metadata.canonical" />
<meta v-if="metadata?.keywords && metadata.keywords !== ''" name="keywords" :content="metadata.keywords" />

<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" name="keywords" property="og:image" :content="metadata.openGraphImage" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" name="keywords" property="og:title" :content="metadata.title" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" name="keywords" property="og:description" :content="metadata.description" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" name="keywords" property="og:image:width" content="1200" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" name="keywords" property="og:image:height" content="630" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" property="og:image" :content="metadata.openGraphImage" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" property="og:title" :content="metadata.title" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" property="og:description" :content="metadata.description" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" property="og:image:width" content="1200" />
<meta v-if="metadata?.openGraphImage && metadata.openGraphImage !== ''" property="og:image:height" content="630" />

<meta v-if="metadata?.twitterCardImage && metadata.twitterCardImage !== ''" name="twitter:card" content="summary_large_image" />
<meta v-if="metadata?.twitterCardImage && metadata.twitterCardImage !== ''" name="twitter:title" :content="metadata.title" />
Expand Down
2 changes: 1 addition & 1 deletion resources/js/Components/Sections/AppPanelLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ defineProps({
<template>
<a
:href="item.url"
class="relative grid grid-cols-1 scale-100 border-2 border-blue-600 dark:border-gray-200 p-8 bg-blue-800 bg-gradient-to-bl from-blue-300/80 via-blue-600 ring-1 ring-inset ring-gray-100/5 rounded-lg motion-safe:hover:scale-[1.01] transition-all duration-250 focus:outline focus:outline-2 focus:outline-blue-600 dark:focus:outline-gray-200"
class="relative grid grid-cols-1 scale-100 border-2 border-gray-400 dark:border-gray-200 p-8 bg-blue-800 bg-gradient-to-bl from-blue-300/80 via-blue-600 ring-1 ring-inset ring-gray-100/5 rounded-lg motion-safe:hover:scale-[1.01] transition-all duration-250 focus:outline focus:outline-2 focus:outline-blue-600 dark:focus:outline-gray-200"
>
<h3 class="text-gray-200 text-xl font-semibold">{{ item.title }}</h3>

Expand Down
2 changes: 1 addition & 1 deletion resources/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
import { ZiggyVue } from '../../vendor/tightenco/ziggy/dist/vue.m'

import.meta.glob([
'../images/**',
'../img/**',
])

const appName = import.meta.env.VITE_APP_NAME || 'Laravel'
Expand Down
9 changes: 9 additions & 0 deletions resources/views/partials/head/default.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
<base href="{{ url('/') }}">
<meta name="robots" content="index, follow" />

@if(config('metadata.open_graph_image'))
<!-- Open Graph Image -->
<meta property="og:image" content="{{ Vite::asset(config('metadata.open_graph_image')) }}" inertia />
<meta property="og:title" content="{{ config('metadata.title') }}" inertia />
<meta property="og:description" content="{{ config('metadata.description') }}" inertia />
<meta property="og:image:width" content="1200" inertia />
<meta property="og:image:height" content="630" inertia />
@endif

@if(config('metadata.author'))
<meta name="author" content="{{ config('metadata.author') }}" />
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use App\Http\Controllers\Public\HomepageController;
use App\Http\Resources\Views\DetailsViewResource;
use App\Http\Resources\Views\MetadataViewResource;
use App\Http\Resources\Views\Public\Content\HomepageContentResource;
use App\Http\Resources\Views\Public\Metadata\HomepageMetadataResource;

test('TEMPLATE_PUBLIC_INDEX Vue page component exists', function () {
$template = (new ReflectionClassConstant(
Expand Down Expand Up @@ -33,7 +33,7 @@

$data = (new DetailsViewResource)->getItem(
(new HomepageContentResource)->getItem(),
(new MetadataViewResource)->getItem([])
(new HomepageMetadataResource)->getItem()
);

expect($actual)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

use App\Http\Resources\Views\Public\Metadata\HomepageMetadataResource;
use App\Interfaces\Resources\Items\ConstantItemInterface;
use Illuminate\Support\Facades\Vite;

arch('it implements the expected interface')
->expect(HomepageMetadataResource::class)
->toImplement(ConstantItemInterface::class);

test('getItem returns ok', function () {
$actual = (new HomepageMetadataResource)->getItem();

expect($actual)
->toHaveCamelCaseKeys()
->toHaveCount(1)
->toMatchArray([
'openGraphImage' => Vite::asset(config('metadata.open_graph_image')),
]);
});