Initial commit
This commit is contained in:
23
site/snippets/blocks/gallery.php
Normal file
23
site/snippets/blocks/gallery.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/** @var \Kirby\Cms\Block $block */
|
||||
?>
|
||||
<figure class="gallery">
|
||||
<ul>
|
||||
<?php foreach ($block->images()->toFiles() as $image): ?>
|
||||
<li>
|
||||
<?php snippet('image', [
|
||||
'alt' => $image->alt(),
|
||||
'contain' => $block->crop()->isTrue(),
|
||||
'lightbox' => true,
|
||||
'ratio' => $block->ratio()->or('auto'),
|
||||
'src' => $image->url(),
|
||||
]) ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php if ($block->caption()->isNotEmpty()): ?>
|
||||
<figcaption>
|
||||
<?= $block->caption() ?>
|
||||
</figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
44
site/snippets/blocks/image.php
Normal file
44
site/snippets/blocks/image.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
Block snippets control the HTML for individual blocks
|
||||
in the blocks field. This image snippet overwrites
|
||||
Kirby's default image block to add custom classes
|
||||
and data attributes.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
|
||||
$src = null;
|
||||
|
||||
if ($block->location()->value() === 'web') {
|
||||
$alt = $block->alt();
|
||||
$src = $block->src();
|
||||
} else if ($image = $block->image()->toFile()) {
|
||||
$alt = $block->alt()->or($image->alt());
|
||||
$src = $image->url();
|
||||
}
|
||||
|
||||
?>
|
||||
<?php if ($src): ?>
|
||||
<figure>
|
||||
<?php snippet('image', [
|
||||
'alt' => $alt,
|
||||
'contain' => $block->crop()->isFalse(),
|
||||
'lightbox' => $block->link()->isEmpty(),
|
||||
'href' => $block->link()->or($src),
|
||||
'src' => $src,
|
||||
'ratio' => $block->ratio()->or('auto')
|
||||
]) ?>
|
||||
|
||||
<?php if ($block->caption()->isNotEmpty()): ?>
|
||||
<figcaption class="img-caption">
|
||||
<?= $block->caption() ?>
|
||||
</figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
24
site/snippets/blocks/video.php
Normal file
24
site/snippets/blocks/video.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
Block snippets control the HTML for individual blocks
|
||||
in the blocks field. This video snippet overwrites
|
||||
Kirby's default video block to add custom classes
|
||||
and style attributes.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<?php if ($block->url()->isNotEmpty()): ?>
|
||||
<figure>
|
||||
<span class="video" style="--w:16;--h:9">
|
||||
<?= video($block->url()) ?>
|
||||
</span>
|
||||
<?php if ($block->caption()->isNotEmpty()): ?>
|
||||
<figcaption class="video-caption"><?= $block->caption() ?></figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
51
site/snippets/footer.php
Normal file
51
site/snippets/footer.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
This footer snippet is reused in all templates.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<div class="grid">
|
||||
<div class="column" style="--columns: 8">
|
||||
<h2><a href="https://getkirby.com">Made with Kirby</a></h2>
|
||||
<p>
|
||||
Kirby: the file-based CMS that adapts to any project, loved by developers and editors alike
|
||||
</p>
|
||||
</div>
|
||||
<div class="column" style="--columns: 2">
|
||||
<h2>Pages</h2>
|
||||
<ul>
|
||||
<?php foreach ($site->children()->listed() as $example): ?>
|
||||
<li><a href="<?= $example->url() ?>"><?= $example->title()->esc() ?></a></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="column" style="--columns: 2">
|
||||
<h2>Kirby</h2>
|
||||
<ul>
|
||||
<li><a href="https://getkirby.com">Website</a></li>
|
||||
<li><a href="https://getkirby.com/docs">Docs</a></li>
|
||||
<li><a href="https://forum.getkirby.com">Forum</a></li>
|
||||
<li><a href="https://chat.getkirby.com">Chat</a></li>
|
||||
<li><a href="https://github.com/getkirby">GitHub</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?= js([
|
||||
'assets/js/prism.js',
|
||||
'assets/js/lightbox.js',
|
||||
'assets/js/index.js',
|
||||
'@auto'
|
||||
]) ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
87
site/snippets/header.php
Normal file
87
site/snippets/header.php
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
This header snippet is reused in all templates.
|
||||
It fetches information from the `site.txt` content file
|
||||
and contains the site navigation.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
|
||||
<?php
|
||||
/*
|
||||
In the title tag we show the title of our
|
||||
site and the title of the current page
|
||||
*/
|
||||
?>
|
||||
<title><?= $site->title()->esc() ?> | <?= $page->title()->esc() ?></title>
|
||||
|
||||
<?php
|
||||
/*
|
||||
Stylesheets can be included using the `css()` helper.
|
||||
Kirby also provides the `js()` helper to include script file.
|
||||
More Kirby helpers: https://getkirby.com/docs/reference/templates/helpers
|
||||
*/
|
||||
?>
|
||||
<?= css([
|
||||
'assets/css/prism.css',
|
||||
'assets/css/lightbox.css',
|
||||
'assets/css/index.css',
|
||||
'@auto'
|
||||
]) ?>
|
||||
|
||||
<?php
|
||||
/*
|
||||
The `url()` helper is a great way to create reliable
|
||||
absolute URLs in Kirby that always start with the
|
||||
base URL of your site.
|
||||
*/
|
||||
?>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="<?= url('favicon.ico') ?>">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header class="header">
|
||||
<?php
|
||||
/*
|
||||
We use `$site->url()` to create a link back to the homepage
|
||||
for the logo and `$site->title()` as a temporary logo. You
|
||||
probably want to replace this with an SVG.
|
||||
*/
|
||||
?>
|
||||
<a class="logo" href="<?= $site->url() ?>">
|
||||
<?= $site->title()->esc() ?>
|
||||
</a>
|
||||
|
||||
<nav class="menu">
|
||||
<?php
|
||||
/*
|
||||
In the menu, we only fetch listed pages,
|
||||
i.e. the pages that have a prepended number
|
||||
in their foldername.
|
||||
|
||||
We do not want to display links to unlisted
|
||||
`error`, `home`, or `sandbox` pages.
|
||||
|
||||
More about page status:
|
||||
https://getkirby.com/docs/reference/panel/blueprints/page#statuses
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($site->children()->listed() as $item): ?>
|
||||
<a <?php e($item->isOpen(), 'aria-current="page"') ?> href="<?= $item->url() ?>"><?= $item->title()->esc() ?></a>
|
||||
<?php endforeach ?>
|
||||
<?php snippet('social') ?>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="main">
|
||||
18
site/snippets/image.php
Normal file
18
site/snippets/image.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
$attrs = attr([
|
||||
'data-lightbox' => $lightbox ?? false,
|
||||
'href' => $href ?? $src,
|
||||
]);
|
||||
|
||||
?>
|
||||
<a <?= $attrs ?>>
|
||||
<img
|
||||
src="<?= esc($src, 'attr') ?>"
|
||||
alt="<?= esc($alt, 'attr') ?>"
|
||||
style="
|
||||
aspect-ratio: <?= $ratio ?? 'auto' ?>;
|
||||
object-fit: <?= ($contain ?? false) ? 'contain' : 'cover' ?>
|
||||
"
|
||||
>
|
||||
</a>
|
||||
20
site/snippets/intro.php
Normal file
20
site/snippets/intro.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
This intro snippet is reused in multiple templates.
|
||||
While it does not contain much code, it helps to keep your
|
||||
code DRY and thus facilitate maintenance when you have
|
||||
to make changes.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<header class="h1">
|
||||
<h1><?= $page->headline()->or($page->title())->esc() ?></h1>
|
||||
<?php if ($page->subheadline()->isNotEmpty()): ?>
|
||||
<p class="color-grey"><?= $page->subheadline()->esc() ?></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
23
site/snippets/layouts.php
Normal file
23
site/snippets/layouts.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
This layouts snippet renders the content of a layout
|
||||
field with our custom grid system.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<?php foreach ($field->toLayouts() as $layout): ?>
|
||||
<section class="grid margin-xl" id="<?= esc($layout->id(), 'attr') ?>" style="--gutter: 1.5rem">
|
||||
<?php foreach ($layout->columns() as $column): ?>
|
||||
<div class="column" style="--columns:<?= esc($column->span(), 'css') ?>">
|
||||
<div class="text">
|
||||
<?= $column->blocks() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
30
site/snippets/note.php
Normal file
30
site/snippets/note.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
The note snippet renders an excerpt of a blog article.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<article class="note-excerpt">
|
||||
<a href="<?= $note->url() ?>">
|
||||
<header>
|
||||
<figure class="img" style="--w: 16; --h:9">
|
||||
<?php if ($cover = $note->cover()): ?>
|
||||
<img src="<?= $cover->crop(320, 180)->url() ?>" alt="<?= $cover->alt()->esc() ?>">
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
|
||||
<h2 class="note-excerpt-title"><?= $note->title()->esc() ?></h2>
|
||||
<time class="note-excerpt-date" datetime="<?= $note->published('c') ?>"><?= $note->published() ?></time>
|
||||
</header>
|
||||
<?php if (($excerpt ?? true) !== false): ?>
|
||||
<div class="note-excerpt-text">
|
||||
<?= $note->text()->toBlocks()->excerpt(280) ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</a>
|
||||
</article>
|
||||
26
site/snippets/pagination.php
Normal file
26
site/snippets/pagination.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
The pagination snippet renders prev/next links in the
|
||||
blog, when articles spread across multiple pages
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<?php if ($pagination->hasPages()): ?>
|
||||
<nav class="pagination">
|
||||
<?php if ($pagination->hasPrevPage()): ?>
|
||||
<a class="pagination-prev" href="<?= $pagination->prevPageUrl() ?>">←</a>
|
||||
<?php else: ?>
|
||||
<span class="pagination-prev">←</span>
|
||||
<?php endif ?>
|
||||
<?php if ($pagination->hasNextPage()): ?>
|
||||
<a class="pagination-next" href="<?= $pagination->nextPageUrl() ?>">→</a>
|
||||
<?php else: ?>
|
||||
<span class="pagination-next">→</span>
|
||||
<?php endif ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
27
site/snippets/prevnext.php
Normal file
27
site/snippets/prevnext.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
The prevnext snippet renders the nice "keep on reading"
|
||||
section below each article in the blog, to jump between
|
||||
articles. It reuses the note snippet to render a full
|
||||
excerpt of the article.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<nav class="blog-prevnext">
|
||||
<h2 class="h2">Keep on reading</h2>
|
||||
|
||||
<div class="autogrid" style="--gutter: 1.5rem">
|
||||
<?php if ($prev = $page->prevListed()): ?>
|
||||
<?php snippet('note', ['note' => $prev, 'excerpt' => false]) ?>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if ($next = $page->nextListed()): ?>
|
||||
<?php snippet('note', ['note' => $next, 'excerpt' => false]) ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</nav>
|
||||
27
site/snippets/social.php
Normal file
27
site/snippets/social.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
In this snippet the svg() helper is a great way to embed SVG
|
||||
code directly in your HTML. Pass the path to your SVG
|
||||
file to load it.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<span class="social">
|
||||
<a href="https://mastodon.social/@getkirby" aria-label="Follow us on Mastodon">
|
||||
<?= svg('assets/icons/mastodon.svg') ?>
|
||||
</a>
|
||||
<a href="https://instagram.com/getkirby" aria-label="Follow us on Instagram">
|
||||
<?= svg('assets/icons/instagram.svg') ?>
|
||||
</a>
|
||||
<a href="https://youtube.com/kirbycasts" aria-label="Watch our videos on YouTube">
|
||||
<?= svg('assets/icons/youtube.svg') ?>
|
||||
</a>
|
||||
<a href="https://chat.getkirby.com" aria-label="Chat with us on Discord">
|
||||
<?= svg('assets/icons/discord.svg') ?>
|
||||
</a>
|
||||
</span>
|
||||
Reference in New Issue
Block a user