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

Add a customizable footer #31

Merged
merged 2 commits into from
Mar 21, 2022
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
20 changes: 20 additions & 0 deletions app/Actions/ConvertsFooterMarkdown.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace App\Actions;

use Illuminate\Support\Str;

class ConvertsFooterMarkdown
{
/**
* Convert the Markdown text if supplied in the config,
* or fall back to default to generate HTML for the footer.
*
* @return string $html
*/
public static function execute(): string
{
return Str::markdown(config('hyde.footer.markdown', 'Site built with the Free and Open Source [HydePHP](https://github.com/hydephp/hyde).
License [MIT](https://github.com/hydephp/hyde/blob/master/LICENSE.md).'));
}
}
33 changes: 27 additions & 6 deletions config/hyde.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
| /___/
|--------------------------------------------------------------------------
|
| Welcome to HydePHP! In this file you can customize your new Static Site!
| Welcome to HydePHP! In this file, you can customize your new Static Site!
|
| HydePHP favors convention over configuration and as such requires virtually
| HydePHP favours convention over configuration and as such requires virtually
| no configuration out of the box to get started. Though, you may want to
| change the options to personalize your site and make it your own!
|
Expand All @@ -21,13 +21,13 @@

return [

/*
/*
|--------------------------------------------------------------------------
| Site Name
|--------------------------------------------------------------------------
|
| This value sets the name of your site and is, for example, used in
| the compiled page titles and more. Default value is "HydePHP".
| the compiled page titles and more. The default value is HydePHP.
|
*/

Expand All @@ -40,8 +40,8 @@
|--------------------------------------------------------------------------
|
| Some of Hyde's features are optional. Feel free to disable the features
| you don't need by removing them from this array or by commenting them.
| This type of configuration is directly inspired by Laravel Jetstream.
| you don't need by removing or commenting them out from this array.
| This config concept is directly inspired by Laravel Jetstream.
|
*/

Expand All @@ -53,6 +53,27 @@
],


/*
|--------------------------------------------------------------------------
| Footer Text
|--------------------------------------------------------------------------
|
| Most websites have a footer with copyright details and contact information.
| You probably want to change the Markdown to include your information,
| though you are of course welcome to keep the attribution link!
|
| You can also customize the blade view if you want a more complex footer.
| You can disable it completely by setting `enabled` to `false`.
|
*/

'footer' => [
'enabled' => true,
'markdown' => 'Site built with the Free and Open Source [HydePHP](https://github.com/hydephp/hyde).
License [MIT](https://github.com/hydephp/hyde/blob/master/LICENSE.md).'
],


/*
|--------------------------------------------------------------------------
| Custom Navigation Menu Links
Expand Down
4 changes: 2 additions & 2 deletions resources/views/layouts/app.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

@include('layouts.meta')
</head>
<body id="app" class="overflow-x-hidden">
<body id="app" class="flex flex-col min-h-screen overflow-x-hidden">
@includeUnless($withoutNavigation ?? false, 'layouts.navigation')

<section id="content">
@yield('content')
</section>

@include('layouts.footer')
@includeWhen(config('hyde.footer.enabled', true), 'layouts.footer')
</body>
</html>
5 changes: 5 additions & 0 deletions resources/views/layouts/footer.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<footer class="py-4 px-6 w-full bg-slate-100 text-center mt-auto">
<div class="prose text-center mx-auto">
{!! App\Actions\ConvertsFooterMarkdown::execute() !!}
</div>
</footer>
2 changes: 1 addition & 1 deletion resources/views/page.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@extends('layouts.app')
@section('content')

<main class="mx-auto max-w-7xl py-16 px-8 lg:mt-8">
<main class="mx-auto max-w-7xl py-16 px-8">
<article @class(['mx-auto prose max-w-5xl', 'torchlight-enabled' => App\Hyde\Hyde::hasTorchlight()])>
{!! $markdown !!}
</article>
Expand Down
2 changes: 1 addition & 1 deletion resources/views/pages/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@extends('layouts.app')
@section('content')

<main class="mx-auto max-w-7xl py-16 px-8 lg:mt-8">
<main class="mx-auto max-w-7xl py-12 px-8">
<header class="lg:mb-12 xl:mb-16">
<h1
class="text-3xl text-left opacity-75 leading-10 tracking-tight font-extrabold sm:leading-none mb-8 md:mb-12 md:text-4xl md:text-center lg:text-5xl">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/post.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@extends('layouts.app')
@section('content')

<main class="mx-auto max-w-7xl py-16 px-8 lg:mt-8">
<main class="mx-auto max-w-7xl py-16 px-8">
@include('components.post.article')
</main>

Expand Down