From ca865821571d819c54a94702eaded5d37d14ccf4 Mon Sep 17 00:00:00 2001 From: Julian Prieber <60265788+JulianPrieber@users.noreply.github.com> Date: Wed, 8 Jun 2022 15:43:51 +0200 Subject: [PATCH] Added support for custom meta tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added support for custom meta tags via a new config file. Custom meta tags will only be active if "CUSTOM_META_TAGS" is set to "true" in the config. Replaced "" with "@include('layouts.lang')" meaning HTML lang can be changed in the new config, defaults to en if not active or not defined. --- config/meta.php | 86 +++++++++++++++++++++ resources/views/home.blade.php | 14 +++- resources/views/layouts/analytics.blade.php | 7 ++ resources/views/layouts/lang.blade.php | 5 ++ resources/views/layouts/meta.blade.php | 15 ++++ resources/views/layouts/sidebar.blade.php | 2 +- resources/views/layouts/updater.blade.php | 2 +- resources/views/littlelink.blade.php | 13 +++- resources/views/pages.blade.php | 2 +- resources/views/panel/phpinfo.blade.php | 2 +- 10 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 config/meta.php create mode 100644 resources/views/layouts/analytics.blade.php create mode 100644 resources/views/layouts/lang.blade.php create mode 100644 resources/views/layouts/meta.blade.php diff --git a/config/meta.php b/config/meta.php new file mode 100644 index 0000000..ab2d983 --- /dev/null +++ b/config/meta.php @@ -0,0 +1,86 @@ + tag of every page. +| Formatting in plain HTML is expected. +| +*/ + +<< + + + + + + + +EOD;; + + + +return [ + + /* + |-------------------------------------------------------------------------- + | Default source repository type + |-------------------------------------------------------------------------- + | + | Will only be active if "CUSTOM_META_TAGS" is set to "true" in the config. + | These tags will only be applied to the home page or if a LittleLink page is set as the homepage in the config + | (For example: HOME_URL="@admin"). + | + | Empty entries will be ignored. + | + */ + + 'lang' => 'en', // Sets + 'title' => 'Title', // Overrides the default meta page title. Leave empty to use your page title as the title. + 'description' => 'This is a description', // Overrides the default meta page description. Leave empty to use your page description as the description. + 'robots' => 'index,follow', + 'viewport' => 'width=device-width, initial-scale=1', + 'canonical_url' => 'https://example.com/', // Tells search engines to index "https://example.com/"  instead of "https://example.com/@admin",  for example. + 'twitter_creator' => '@elonmusk', // Twitter @username. For example: "@elonmusk". + 'author' => 'Julian Prieber', // Your name. + + /* + |-------------------------------------------------------------------------- + | Additional settings + |-------------------------------------------------------------------------- + | + | Empty entries will be ignored. + | + */ + + + // Overwrites default theme regardless of preference defined by the operating system, unless manually overwritten by user. + 'theme' => '', // Either "dark" or "light". + + + // Overwrites default theme regardless of preference defined by the operating system, unless manually overwritten by user. + // Overwrites default page title after the LittleLink name on LittleLink pages. + // Example: "admin 🔗 LittleLink Custom" + // ⤌------------------⤍ + // ⬑ What you can change with this setting. + 'littlelink_title' => '', + + + + // Do not change here! + 'analytics' => $analytics, // Set on top of page. + +]; \ No newline at end of file diff --git a/resources/views/home.blade.php b/resources/views/home.blade.php index 2107df5..d4892c4 100755 --- a/resources/views/home.blade.php +++ b/resources/views/home.blade.php @@ -1,11 +1,23 @@ - +@include('layouts.lang') + + @if(env('CUSTOM_META_TAGS') == 'true' and Config::get('meta.title') != '') + {{ Config::get('meta.title') }} + @else {{ config('app.name') }} + @endif + home_message); ?> + + @if(env('CUSTOM_META_TAGS') == 'true') + @include('layouts.meta') + @else + @endif + diff --git a/resources/views/layouts/analytics.blade.php b/resources/views/layouts/analytics.blade.php new file mode 100644 index 0000000..89f8ad0 --- /dev/null +++ b/resources/views/layouts/analytics.blade.php @@ -0,0 +1,7 @@ + +~s", "", $analyticsHTML); +echo $analyticsHTML; +?> + \ No newline at end of file diff --git a/resources/views/layouts/lang.blade.php b/resources/views/layouts/lang.blade.php new file mode 100644 index 0000000..3d114d9 --- /dev/null +++ b/resources/views/layouts/lang.blade.php @@ -0,0 +1,5 @@ +@if(env('CUSTOM_META_TAGS') == 'true' and Config::get('meta.lang') != '') + +@else +@include('layouts.lang') +@endif \ No newline at end of file diff --git a/resources/views/layouts/meta.blade.php b/resources/views/layouts/meta.blade.php new file mode 100644 index 0000000..f12650f --- /dev/null +++ b/resources/views/layouts/meta.blade.php @@ -0,0 +1,15 @@ +@if(Config::get('meta.description') != '') +@elseif(Route::currentRouteName() != 'home') +@else@endif + +@if(Config::get('meta.author') != '') +@elseif(Route::currentRouteName() != 'home')@endif + +@if(Config::get('meta.viewport') != '') +@else@endif + +@if(Config::get('meta.robots') != '')@endif + +@if(Config::get('meta.canonical_url') != '')@endif + +@if(Config::get('meta.twitter_creator') != '')@endif diff --git a/resources/views/layouts/sidebar.blade.php b/resources/views/layouts/sidebar.blade.php index bab1509..ed71732 100755 --- a/resources/views/layouts/sidebar.blade.php +++ b/resources/views/layouts/sidebar.blade.php @@ -1,5 +1,5 @@ - +@include('layouts.lang') Studio ⚙️ {{ config('app.name') }} diff --git a/resources/views/layouts/updater.blade.php b/resources/views/layouts/updater.blade.php index 7c9ba06..b7f62a6 100644 --- a/resources/views/layouts/updater.blade.php +++ b/resources/views/layouts/updater.blade.php @@ -1,6 +1,6 @@ - +@include('layouts.lang') diff --git a/resources/views/littlelink.blade.php b/resources/views/littlelink.blade.php index 55680b0..61bdf18 100644 --- a/resources/views/littlelink.blade.php +++ b/resources/views/littlelink.blade.php @@ -1,15 +1,24 @@ - +@include('layouts.lang') - @if(env('HOME_URL') != '') + @if(Config::get('meta.littlelink_title') != '' and env('HOME_URL') === '') + {{ $userinfo->name }} {{ Config::get('meta.littlelink_title') }} + @elseif(env('CUSTOM_META_TAGS') == 'true' and Config::get('meta.title') != '') + {{ Config::get('meta.title') }} + @elseif(env('HOME_URL') != '') {{ $userinfo->name }} @else {{ $userinfo->name }} 🔗 {{ config('app.name') }} @endif + +@if(env('CUSTOM_META_TAGS') == 'true') +@include('layouts.meta') +@else +@endif diff --git a/resources/views/pages.blade.php b/resources/views/pages.blade.php index 4d9b97c..125647b 100755 --- a/resources/views/pages.blade.php +++ b/resources/views/pages.blade.php @@ -1,5 +1,5 @@ - +@include('layouts.lang') {{ config('app.name') }} diff --git a/resources/views/panel/phpinfo.blade.php b/resources/views/panel/phpinfo.blade.php index 0b6c756..bf74ad5 100644 --- a/resources/views/panel/phpinfo.blade.php +++ b/resources/views/panel/phpinfo.blade.php @@ -1,5 +1,5 @@ - +@include('layouts.lang') @if(auth()->user()->role == 'admin')