Skip to content

Commit bd56b26

Browse files
committed
upgrade kirby, improve format
1 parent ee3c3c0 commit bd56b26

File tree

14 files changed

+176
-121
lines changed

14 files changed

+176
-121
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ node_modules
6363
# Generated CSS assets
6464
# ---------------
6565

66-
/assets/css/tailwind.css
66+
/assets/css/*.css
6767

6868
# Update script
6969
# ---------------

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "site/plugins/kirby3-robots-txt"]
88
path = site/plugins/kirby3-robots-txt
99
url = https://github.com/bnomei/kirby3-robots-txt.git
10+
[submodule "site/plugins/kirby3-matomo"]
11+
path = site/plugins/kirby3-matomo
12+
url = https://github.com/sylvainjule/kirby-matomo.git

kirby

Submodule kirby updated 75 files

site/config/config.php

+84-53
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,95 @@
11
<?php
22

33
return [
4-
'languages' => false,
5-
'languages.detect' => true,
6-
'debug' => false,
7-
'updates' => [
8-
'plugins' => [
9-
'sylvainjule/matomo' => false,
10-
'bnomei/robots-txt' => false,
11-
'philipptrenz/kirby3-seo' => false,
12-
]
4+
'languages' => false,
5+
'languages.detect' => true,
6+
7+
'date.handler' => 'intl',
8+
'locale' => 'en_US.UTF-8',
9+
10+
'debug' => false,
11+
12+
'updates' => [
13+
'plugins' => [
14+
'sylvainjule/matomo' => false,
15+
'bnomei/robots-txt' => false,
16+
'philipptrenz/kirby3-seo' => false,
17+
]
18+
],
19+
20+
'libs' => [
21+
'flickity' => [
22+
'enabled' => false
1323
],
14-
'routes' => [
15-
[
16-
'pattern' => 'sitemap.xml',
17-
'action' => function() {
18-
$pages = site()->pages()->index();
24+
'alpine' => [
25+
'enabled' => true,
26+
'mask' => false,
27+
'intersect' => true,
28+
'persist' => false,
29+
'focus' => false,
30+
'collapse' => true,
31+
],
32+
'smooth-scroll' => [
33+
'enabled' => true
34+
],
35+
],
36+
37+
'routes' => [
38+
[
39+
'pattern' => 'sitemap.xml',
40+
'action' => function() {
41+
$pages = site()->pages()->index();
1942

20-
// fetch the pages to ignore from the config settings,
21-
// if nothing is set, we ignore the error page
22-
$ignore = kirby()->option('sitemap.ignore', ['error']);
43+
// fetch the pages to ignore from the config settings,
44+
// if nothing is set, we ignore the error page
45+
$ignore = kirby()->option('sitemap.ignore', ['error']);
2346

24-
$content = snippet('sitemap', compact('pages', 'ignore'), true);
47+
$content = snippet('sitemap', compact('pages', 'ignore'), true);
2548

26-
// return response with correct header type
27-
return new Kirby\Cms\Response($content, 'application/xml');
28-
}
29-
],
30-
[
31-
'pattern' => 'sitemap',
32-
'action' => function() {
33-
return go('sitemap.xml', 301);
34-
}
35-
]
49+
// return response with correct header type
50+
return new Kirby\Cms\Response($content, 'application/xml');
51+
}
3652
],
37-
'bnomei.robots-txt' => [
38-
'sitemap' => 'sitemap.xml',
39-
'groups' => function() {
40-
if (site()->globalNoIndex()->toBool()) {
41-
return [
42-
'*' => [
43-
'disallow' => [
44-
'/',
45-
]
53+
[
54+
'pattern' => 'sitemap',
55+
'action' => function() {
56+
return go('sitemap.xml', 301);
57+
}
58+
]
59+
],
60+
61+
'bnomei.robots-txt' => [
62+
'sitemap' => 'sitemap.xml',
63+
'groups' => function() {
64+
if (site()->globalNoIndex()->toBool()) {
65+
return [
66+
'*' => [
67+
'disallow' => [
68+
'/',
4669
]
47-
];
48-
} else {
49-
return [
50-
'*' => [ // user-agent
51-
'disallow' => [
52-
'/kirby/',
53-
'/site/',
54-
'/storage/',
55-
],
56-
'allow' => [
57-
'/media/',
58-
]
70+
]
71+
];
72+
} else {
73+
return [
74+
'*' => [ // user-agent
75+
'disallow' => [
76+
'/kirby/',
77+
'/site/',
78+
'/storage/',
79+
],
80+
'allow' => [
81+
'/media/',
5982
]
60-
];
61-
}
62-
},
63-
],
83+
]
84+
];
85+
}
86+
},
87+
],
88+
89+
'sylvainjule.matomo' => [
90+
'url' => '',
91+
'id' => '',
92+
'token' => '',
93+
'disableCookies' => true,
94+
],
6495
];

site/plugins/kirby3-matomo

Submodule kirby3-matomo added at 8662f8e

site/snippets/comps/footer.php

Whitespace-only changes.

site/snippets/comps/header.php

Whitespace-only changes.

site/snippets/foot.php

-28
This file was deleted.

site/snippets/framework.php

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<!DOCTYPE html>
2+
<html lang="<?= $kirby->language() ? $kirby->language()->code() : 'en' ?>">
3+
4+
<?php
5+
$libs = option('libs');
6+
7+
$themeColor = '';
8+
$maskIconColor = '';
9+
10+
11+
?>
12+
13+
<head>
14+
<meta charset="UTF-8">
15+
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
16+
<?= snippet('seo/meta') ?>
17+
<?= snippet('seo/favicon', [
18+
'themeColor' => $themeColor,
19+
'maskIconColor' => $maskIconColor,
20+
]) ?>
21+
<?php if ($libs['flickity'] && $libs['flickity']['enabled'] === true): ?>
22+
<?= css('assets/css/flickity.min.css') ?>
23+
<?php endif; ?>
24+
<?= css('assets/css/tailwind.css') ?>
25+
<?= snippet('matomo') ?>
26+
</head>
27+
28+
<body class="<?= " " . $bodyclasses ?? '' ?>">
29+
30+
<!-- HEADER -->
31+
<header class="">
32+
<?= snippet('comps/header') ?>
33+
</header>
34+
35+
<!-- PAGE CONTENT -->
36+
<main class="">
37+
<?= $slot ?>
38+
</main>
39+
40+
<!-- FOOTER -->
41+
<footer class="">
42+
<?= snippet('comps/footer') ?>
43+
</footer>
44+
45+
<!-- JS LIBRARIES -->
46+
<?php
47+
if ($libs['flickity'] && $libs['flickity']['enabled'] === true) {
48+
echo(js('/assets/js/flickity/core.min.js', [ 'defer' => true ]));
49+
}
50+
51+
if ($libs['alpine'] && $libs['alpine']['enabled'] === true) {
52+
53+
$alpine = [];
54+
55+
if ($libs['alpine']['mask'] === true) $alpine[] = '/assets/js/alpine/mask.min.js';
56+
if ($libs['alpine']['intersect'] === true) $alpine[] = '/assets/js/alpine/intersect.min.js';
57+
if ($libs['alpine']['persist'] === true) $alpine[] = '/assets/js/alpine/persist.min.js';
58+
if ($libs['alpine']['focus'] === true) $alpine[] = '/assets/js/alpine/focus.min.js';
59+
if ($libs['alpine']['collapse'] === true) $alpine[] = '/assets/js/alpine/collapse.min.js';
60+
61+
$alpine[] = "/assets/js/alpine/core.min.js"; // Must be imported last
62+
63+
echo(js($alpine, [ 'defer' => true ]));
64+
}
65+
66+
if ($libs['smooth-scroll'] && $libs['smooth-scroll']['enabled'] === true) {
67+
echo(js('/assets/js/smooth-scroll/init.js', [ 'defer' => true ]));
68+
echo(js('/assets/js/smooth-scroll/core.min.js', [ 'async' => true, 'id' => 'smooth-scroll' ]));
69+
}
70+
?>
71+
72+
</body>
73+
</html>

site/snippets/head.php

-17
This file was deleted.
File renamed without changes.

site/tailwind/fonts.css

Whitespace-only changes.

site/tailwind/tailwind.css

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
@import "fonts.css";
2+
13
@tailwind base;
24
@tailwind components;
35
@tailwind utilities;
46

5-
[x-cloak] { display: none !important; }
7+
[x-cloak] { display: none !important; } /* Alpine.js */
8+
9+
html {
10+
@apply scroll-smooth;
11+
}
12+
13+
body {
14+
@apply min-h-screen;
15+
}

site/templates/default.php

+2-20
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,6 @@
1-
<?php
2-
$libs = [
3-
'flickity' => [
4-
'enabled' => true
5-
],
6-
'alpine' => [
7-
'enabled' => false,
8-
'mask' => false,
9-
'intersect' => false,
10-
'persist' => false,
11-
'focus' => false,
12-
'collapse' => false,
13-
],
14-
'smooth-scroll' => [
15-
'enabled' => false
16-
],
17-
];
18-
?>
19-
<?php snippet('head', [ 'bodyclasses' => 'p-6', 'libs' => $libs ]); ?>
1+
<?php snippet('framework', [ 'bodyclasses' => ''], slots: true); ?>
202

213
<h1 class="font-bold text-2xl text-center"><?= $page->title() ?></h1>
224
<p class=""><?= $page->text() ?></p>
235

24-
<?php snippet('foot', [ 'libs' => $libs ]); ?>
6+
<?php endsnippet() ?>

0 commit comments

Comments
 (0)