Skip to content

Instantly share code, notes, and snippets.

View lukaskleinschmidt's full-sized avatar

Lukas Kleinschmidt lukaskleinschmidt

  • Aachen, Germany
  • 04:51 (UTC +01:00)
View GitHub Profile
@lukaskleinschmidt
lukaskleinschmidt / UuidModels.php
Created June 14, 2024 10:32
Kirby 4 fetch models from the uuid cache
<?php
use Kirby\Cache\FileCache;
use Kirby\Uuid\Identifiable;
use Kirby\Uuid\Uuid;
class UuidModels
{
/**
* Create a new instance.
@lukaskleinschmidt
lukaskleinschmidt / blueprint.yaml
Created April 18, 2024 14:46
Kirby 4 query pages from a searchengine for the pages field
fields:
articles:
type: pages
query: kirby.collection('articles')
@lukaskleinschmidt
lukaskleinschmidt / README.md
Last active October 31, 2023 10:08
Kirby CLI Commands

Warning Make sure you have the old and new blueprint available when running this command.
Otherwise this command will wipe the currently stored content.
Always make sure to test the command first and have a backup of your content!

@lukaskleinschmidt
lukaskleinschmidt / Menu.php
Last active March 1, 2024 15:57
Kirby 4 Panel Menu
<?php
namespace App;
use Closure;
use Kirby\Cms\App;
class Menu
{
public static array $pages = [];
@lukaskleinschmidt
lukaskleinschmidt / index.php
Created June 15, 2023 09:19
Kirby Snippet Assets Plugin using Vite
<?php
use Kirby\Cms\App;
use Kirby\Toolkit\A;
App::plugin('lukaskleinschmidt/snippet-assets', [
'hooks' => [
'page.render:after' => function (string $contentType, string $html) {
if ($contentType === 'html') {
$html = preg_replace_callback('/<\/head>/', fn ($matches) =>
@lukaskleinschmidt
lukaskleinschmidt / index.php
Last active June 15, 2023 08:36
Kirby Snippet Assets Plugin
<?php
use Kirby\Cms\App;
use Kirby\Toolkit\A;
App::plugin('lukaskleinschmidt/snippet-assets', [
'hooks' => [
'page.render:after' => function (string $contentType, string $html) {
if ($contentType === 'html') {
$html = preg_replace_callback('/<\/head>/', fn ($matches) =>
@lukaskleinschmidt
lukaskleinschmidt / LICENSE.md
Last active April 14, 2024 14:26
Kirby 3 Synced Structure

MIT License

Copyright (c) 2023 Lukas Kleinschmidt

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT

@lukaskleinschmidt
lukaskleinschmidt / HandleInertiaRequests.php
Last active September 25, 2024 04:08
inertia-laravel multiple root views
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Inertia\Middleware;
class HandleInertiaRequests extends Middleware
{
@lukaskleinschmidt
lukaskleinschmidt / index.php
Created October 23, 2020 08:35
Add page models automatically in Kirby 3
<?php
use Kirby\Cms\App as Kirby;
use Kirby\Cms\Page;
use Kirby\Toolkit\A;
class DefaultPage extends Page
{
//
}
@lukaskleinschmidt
lukaskleinschmidt / bootstrap.php
Created March 2, 2020 09:17
Kirby Thumbnails
<?php
// bootstrap/kirby.php
include dirname(__DIR__) . '/vendor/autoload.php';
$kirby = new Kirby([
'roots' => [
'base' => $base = dirname(__DIR__),
'index' => $base . '/public',
'content' => $base . '/content',