Design adjustments, new content and more
This commit is contained in:
4
site/blueprints/files/blocks/image.yml
Normal file
4
site/blueprints/files/blocks/image.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
# The blocks/image template is automatically assigned to all uploaded
|
||||
# images in the blocks field. We don't really need a separate blueprint
|
||||
# for this and can therefor extend the already existing files/image blueprint
|
||||
extends: files/image
|
@@ -17,39 +17,63 @@ options:
|
||||
changeSlug: false
|
||||
delete: false
|
||||
|
||||
# Define the form layout with two columns, each column has a set of fields
|
||||
# Columns are optional but help structure the form layout
|
||||
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
|
||||
columns:
|
||||
- width: 1/2
|
||||
# We use tabs here to focus on the layout in one tab
|
||||
# and have the additional contact fields in a secondary
|
||||
# tab. Tabs can really help to clean up the interface
|
||||
# when it otherwise gets too complicated
|
||||
tabs:
|
||||
content:
|
||||
icon: text
|
||||
label: content
|
||||
fields:
|
||||
text:
|
||||
label: Text
|
||||
type: textarea
|
||||
size: huge
|
||||
|
||||
- width: 1/2
|
||||
# Kirby has many different field types, from simple text fields to the more complex structure field that contains subfields
|
||||
# All available field types: https://getkirby.com/docs/reference/panel/fields
|
||||
fields:
|
||||
address:
|
||||
label: Address
|
||||
type: textarea
|
||||
email:
|
||||
label: Email
|
||||
type: email
|
||||
phone:
|
||||
label: Phone
|
||||
type: tel
|
||||
social:
|
||||
label: On the web
|
||||
type: structure
|
||||
layout:
|
||||
label: Layout
|
||||
type: layout
|
||||
layouts:
|
||||
- "1/1"
|
||||
- "1/2, 1/2"
|
||||
- "1/3, 1/3, 1/3"
|
||||
# The contact tab pre-defines a set of address
|
||||
# fields for the contact box at the bottom of the about
|
||||
# page. Combining modular content from layouts with
|
||||
# pre-defined content from such fields is a great way to
|
||||
# offer flexibility and yet keep certain constraints.
|
||||
#
|
||||
# The form layout is created with two columns,
|
||||
# each column has a set of fields
|
||||
# More about columns:
|
||||
# https://getkirby.com/docs/guide/blueprints/layout#defining-columns
|
||||
contact:
|
||||
icon: map
|
||||
label: Contact
|
||||
columns:
|
||||
- width: 1/2
|
||||
# Kirby has many different field types, from simple text fields to the more complex structure field that contains subfields
|
||||
# All available field types: https://getkirby.com/docs/reference/panel/fields
|
||||
fields:
|
||||
platform:
|
||||
label: Platform
|
||||
type: text
|
||||
width: 1/2
|
||||
url:
|
||||
label: URL
|
||||
type: url
|
||||
width: 1/2
|
||||
address:
|
||||
label: Address
|
||||
type: writer
|
||||
inline: true
|
||||
email:
|
||||
label: Email
|
||||
type: email
|
||||
phone:
|
||||
label: Phone
|
||||
type: tel
|
||||
- width: 1/2
|
||||
fields:
|
||||
social:
|
||||
label: On the web
|
||||
type: structure
|
||||
columns:
|
||||
platform: true
|
||||
fields:
|
||||
platform:
|
||||
label: Platform
|
||||
type: text
|
||||
width: 1/2
|
||||
url:
|
||||
label: URL
|
||||
type: url
|
||||
width: 1/2
|
||||
|
@@ -17,9 +17,30 @@ status:
|
||||
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
|
||||
|
||||
columns:
|
||||
- width: 1/3
|
||||
# The first column contains a set of fields to store
|
||||
# information about the album.
|
||||
#
|
||||
# List of all available field types:
|
||||
# https://getkirby.com/docs/reference/panel/fields
|
||||
fields:
|
||||
cover:
|
||||
type: files
|
||||
multiple: false
|
||||
headline:
|
||||
type: text
|
||||
placeholder: "{{ page.title }}"
|
||||
help: Leave empty to use the title as headline
|
||||
subheadline:
|
||||
type: text
|
||||
text:
|
||||
type: writer
|
||||
tags: true
|
||||
|
||||
- width: 2/3
|
||||
sections:
|
||||
## The `images` files section shows all images of the current page that use the `image` template
|
||||
# The `images` files section shows all images of
|
||||
# the current page that use the `image` template
|
||||
images:
|
||||
type: files
|
||||
layout: cards
|
||||
@@ -31,15 +52,3 @@ columns:
|
||||
min: 1
|
||||
size: small
|
||||
|
||||
- width: 1/3
|
||||
# The second column contains a set of fields
|
||||
# List of all available field types: https://getkirby.com/docs/reference/panel/fields
|
||||
fields:
|
||||
cover:
|
||||
type: files
|
||||
multiple: false
|
||||
headline:
|
||||
type: text
|
||||
description:
|
||||
type: textarea
|
||||
tags: true
|
||||
|
@@ -12,10 +12,17 @@ options:
|
||||
|
||||
# Here we define an info section and a pages section (`photography`)
|
||||
sections:
|
||||
info:
|
||||
headline: Info
|
||||
type: info
|
||||
text: All content for the homepage is being pulled from the photography page.
|
||||
content:
|
||||
type: fields
|
||||
fields:
|
||||
headline:
|
||||
type: text
|
||||
width: 1/2
|
||||
gap:
|
||||
width: 1/2
|
||||
subheadline:
|
||||
type: text
|
||||
width: 1/2
|
||||
|
||||
# The photography section extends a pages section defined in the `/site/blueprints/section/album.yml` blueprint
|
||||
# More about reusing and extending sections: https://getkirby.com/docs/guide/blueprints/extending-blueprints#reusing-and-extending-sectionss
|
||||
@@ -23,5 +30,7 @@ sections:
|
||||
headline: Photography
|
||||
extends: sections/albums
|
||||
status: listed
|
||||
size: small
|
||||
help: All projects for the homepage are being pulled from the photography page.
|
||||
|
||||
|
||||
|
@@ -29,8 +29,7 @@ columns:
|
||||
# This columns only has a single field
|
||||
fields:
|
||||
text:
|
||||
type: textarea
|
||||
size: large
|
||||
type: blocks
|
||||
|
||||
- width: 1/3
|
||||
# This second column holds a fields section with multiple fields
|
||||
@@ -48,13 +47,6 @@ columns:
|
||||
# Fields types can be added using the shortcut `fieldname: true`
|
||||
# (however, you can only use a fieldname once per page and this only makes sense for simple fields without configuration)
|
||||
tags: true
|
||||
gallery:
|
||||
type: pages
|
||||
query: kirby.page("photography").children
|
||||
multiple: false
|
||||
info: "{{ page.images.count }} image(s)"
|
||||
empty: "No gallery selected"
|
||||
image:
|
||||
cover: true
|
||||
# Use the `help` property of fields and section to provide editors with helpful information
|
||||
help: Place the \{\{ gallery }} tag anywhere in your text to add the selected gallery
|
||||
files:
|
||||
type: files
|
||||
template: blocks/image
|
||||
|
@@ -8,7 +8,7 @@ icon: 📖
|
||||
# More about columns: https://getkirby.com/docs/guide/blueprints/layout#defining-columns
|
||||
|
||||
columns:
|
||||
- width: 1/2
|
||||
- width: 1/3
|
||||
# In the first column, we reuse the `notes` section
|
||||
# (defined in `/site/blueprints/sections/notes.yml` twice with different page status and headline
|
||||
sections:
|
||||
@@ -22,12 +22,14 @@ columns:
|
||||
headline: In Review
|
||||
status: unlisted
|
||||
|
||||
- width: 1/2
|
||||
- width: 2/3
|
||||
# In the second column, we reuse the same section, this time for listed pages and with a different headline
|
||||
sections:
|
||||
listed:
|
||||
extends: sections/notes
|
||||
headline: Published
|
||||
status: listed
|
||||
size: small
|
||||
layout: cards
|
||||
|
||||
# More about pages sections: https://getkirby.com/docs/reference/panel/sections/pages
|
||||
|
@@ -1,31 +0,0 @@
|
||||
# Each page blueprint must have a title, the title may be different from the file name
|
||||
title: Sandbox
|
||||
|
||||
# Page presets are a quick way to set up a standard page layout
|
||||
# More about page presets:
|
||||
# - https://getkirby.com/docs/guide/blueprints/presets and
|
||||
# - https://getkirby.com/docs/reference/panel/presets/page
|
||||
preset: page
|
||||
|
||||
# Sorting number scheme that is applied when page status is changed to `listed`
|
||||
# More about page sorting: https://getkirby.com/docs/reference/panel/blueprints/page#sorting
|
||||
num: zero
|
||||
|
||||
# Limit subpage display to certain templates in a page preset
|
||||
pages:
|
||||
template: sandbox
|
||||
|
||||
# A page preset can have a freely defined set of fields
|
||||
# List of all available field types: https://getkirby.com/docs/reference/panel/fields
|
||||
fields:
|
||||
headline:
|
||||
type: text
|
||||
test:
|
||||
type: structure
|
||||
translate: false
|
||||
fields:
|
||||
itemimage:
|
||||
label: Image
|
||||
type: files
|
||||
max: 1
|
||||
parent: kirby.page('photography').children.first
|
@@ -5,7 +5,7 @@
|
||||
type: pages
|
||||
headline: Photography
|
||||
parent: kirby.page("photography")
|
||||
size: tiny
|
||||
size: small
|
||||
info: "{{ page.images.count }} image(s)"
|
||||
layout: cards
|
||||
template: album
|
||||
|
@@ -5,7 +5,11 @@
|
||||
type: pages
|
||||
headline: Notes
|
||||
parent: kirby.page("notes")
|
||||
info: "{{ page.date.toDate('d.m.Y') }}"
|
||||
info: "{{ page.published }}"
|
||||
template: note
|
||||
empty: No notes yet
|
||||
sortBy: date desc
|
||||
image:
|
||||
query: page.cover
|
||||
cover: true
|
||||
ratio: 3/2
|
||||
|
8
site/collections/notes.php
Executable file
8
site/collections/notes.php
Executable file
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
return function () {
|
||||
return page('notes')
|
||||
->children()
|
||||
->listed()
|
||||
->sortBy('date', 'desc');
|
||||
};
|
@@ -1,12 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Controllers allow you to separate the logic of your templates from your markup.
|
||||
* This is especially useful for complex logic, but also in general to keep your templates clean.
|
||||
*
|
||||
* In this example, we define the `$gallery` variable which is passed to the template
|
||||
* More about controllers: https://getkirby.com/docs/guide/templates/controllers
|
||||
*
|
||||
* More about controllers:
|
||||
* https://getkirby.com/docs/guide/templates/controllers
|
||||
*/
|
||||
|
||||
return function ($page) {
|
||||
|
||||
$gallery = $page->images()->sortBy('sort', 'filename');
|
||||
|
15
site/controllers/note.php
Executable file
15
site/controllers/note.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* Controllers allow you to separate the logic of your templates from your markup.
|
||||
* This is especially useful for complex logic, but also in general to keep your templates clean.
|
||||
*
|
||||
* In this example, we split the tags from the tags field to create a nice tag list
|
||||
*
|
||||
* More about controllers:
|
||||
* https://getkirby.com/docs/guide/templates/controllers
|
||||
*/
|
||||
return function ($page) {
|
||||
return [
|
||||
'tags' => $page->tags()->split(','),
|
||||
];
|
||||
};
|
26
site/controllers/notes.php
Executable file
26
site/controllers/notes.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Controllers allow you to separate the logic of your templates from your markup.
|
||||
* This is especially useful for complex logic, but also in general to keep your templates clean.
|
||||
*
|
||||
* In this example, we handle tag filtering and paginating notes in the controller,
|
||||
* before we pass the currently active tag and the notes to the template.
|
||||
*
|
||||
* More about controllers:
|
||||
* https://getkirby.com/docs/guide/templates/controllers
|
||||
*/
|
||||
return function ($page) {
|
||||
|
||||
$tag = urldecode(param('tag'));
|
||||
$notes = collection('notes');
|
||||
|
||||
if (empty($tag) === false) {
|
||||
$notes = $notes->filterBy('tags', $tag, ',');
|
||||
}
|
||||
|
||||
return [
|
||||
'tag' => $tag,
|
||||
'notes' => $notes->paginate(6)
|
||||
];
|
||||
|
||||
};
|
@@ -1,15 +1,19 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Page models extend Kirby's default page object.
|
||||
* In page models you can define methods that are then available everywhere in Kirby where you call a page of the extended type.
|
||||
* In this example, we define the cover method that either returns an image selected in the cover field
|
||||
* or the first image in the folder.
|
||||
* You can see the method in use in the `home.php`, `photography.php` and `album.php` templates
|
||||
* Page models extend Kirby's default page object.
|
||||
*
|
||||
* In page models you can define methods that are then available
|
||||
* everywhere in Kirby where you call a page of the extended type.
|
||||
*
|
||||
* In this example, we define the cover method that either returns
|
||||
* an image selected in the cover field or the first image in the folder.
|
||||
*
|
||||
* You can see the method in use in the `home.php` and `photography.php` templates
|
||||
* and in the `site/blueprints/sections/albums.yml` image query
|
||||
*
|
||||
* More about models: https://getkirby.com/docs/guide/templates/page-models
|
||||
*/
|
||||
|
||||
class AlbumPage extends Page
|
||||
{
|
||||
public function cover()
|
||||
|
31
site/models/note.php
Executable file
31
site/models/note.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Page models extend Kirby's default page object.
|
||||
*
|
||||
* In page models you can define methods that are then available
|
||||
* everywhere in Kirby where you call a page of the extended type.
|
||||
*
|
||||
* In this example, we define the cover method that either returns
|
||||
* an image selected in the cover field or the first image in the folder.
|
||||
*
|
||||
* You can see the method in use in the `note.php` snippet.
|
||||
* and in the `site/blueprints/sections/notes.yml` image query
|
||||
*
|
||||
* We also define a custom date handler here, which keeps date formatting
|
||||
* for the published date consistent in templates, snippets and blueprints.
|
||||
*
|
||||
* More about models: https://getkirby.com/docs/guide/templates/page-models
|
||||
*/
|
||||
class NotePage extends Page
|
||||
{
|
||||
public function cover()
|
||||
{
|
||||
return $this->content()->cover()->toFile() ?? $this->image();
|
||||
}
|
||||
|
||||
public function published($format = null)
|
||||
{
|
||||
return parent::date()->toDate($format ?? 'd M, Y');
|
||||
}
|
||||
}
|
@@ -1,24 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Plugins extend Kirby's core functionality.
|
||||
* You can extend/replace almost any system-relevant part.
|
||||
* This plugin uses a hook to replace the `{{ gallery }}` placeholders used in the note pages
|
||||
* with images from the selected album page that servers as gallery provider
|
||||
* More about plugins: https://getkirby.com/docs/guide/plugins/plugin-basics
|
||||
*/
|
||||
|
||||
Kirby::plugin('starterkit/gallery', [
|
||||
'hooks' => [
|
||||
'kirbytags:after' => function ($text, $data, $options) {
|
||||
|
||||
if ($page = $data['parent']->gallery()->toPage()) {
|
||||
$gallery = snippet('gallery', ['gallery' => $page], true);
|
||||
} else {
|
||||
$gallery = '';
|
||||
}
|
||||
|
||||
return str_replace('{{ gallery }}', $gallery, $text);
|
||||
}
|
||||
]
|
||||
]);
|
59
site/snippets/blocks/image.php
Executable file
59
site/snippets/blocks/image.php
Executable file
@@ -0,0 +1,59 @@
|
||||
<?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
|
||||
*/
|
||||
|
||||
$alt = $block->alt();
|
||||
$caption = $block->caption();
|
||||
$contain = $block->crop()->isFalse();
|
||||
$link = $block->link();
|
||||
$ratio = $block->ratio()->or('auto');
|
||||
$class = $ratio != 'auto' ? 'img' : 'auto';
|
||||
$src = null;
|
||||
$lightbox = $link->isEmpty();
|
||||
|
||||
if ($block->location() == 'web') {
|
||||
$src = $block->src();
|
||||
} elseif ($image = $block->image()->toFile()) {
|
||||
$alt = $alt ?? $image->alt();
|
||||
$src = $image->url();
|
||||
}
|
||||
|
||||
if ($ratio !== 'auto') {
|
||||
$ratio = Str::split($ratio, '/');
|
||||
$w = $ratio[0] ?? 1;
|
||||
$h = $ratio[1] ?? 1;
|
||||
}
|
||||
|
||||
$attrs = attr([
|
||||
'class' => $class,
|
||||
'data-contain' => $contain,
|
||||
'data-lightbox' => $lightbox,
|
||||
'href' => $link->or($src),
|
||||
'style' => '--w:' . $w . '; --h:' . $h,
|
||||
]);
|
||||
|
||||
?>
|
||||
<?php if ($src): ?>
|
||||
<figure>
|
||||
<a <?= $attrs ?>>
|
||||
<img src="<?= $src ?>" alt="<?= $alt ?>">
|
||||
</a>
|
||||
|
||||
<?php if ($caption->isNotEmpty()): ?>
|
||||
<figcaption class="img-caption">
|
||||
<?= $caption ?>
|
||||
</figcaption>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
<?php endif ?>
|
24
site/snippets/blocks/video.php
Executable file
24
site/snippets/blocks/video.php
Executable 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 ?>
|
@@ -1,26 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* Snippets are a great way to store code snippets for reuse or to keep your templates clean.
|
||||
* in loops or simply to keep your templates clean.
|
||||
* This footer snippet is reused in all templates. In fetches information from the `site.txt` content file
|
||||
* and from the `about` page.
|
||||
* More about snippets: https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
</div>
|
||||
This footer snippet is reused in all templates.
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
</main>
|
||||
|
||||
<footer class="footer">
|
||||
<a href="<?= url() ?>">© <?= date('Y') ?> / <?= $site->title() ?></a>
|
||||
|
||||
<?php if ($about = page('about')): ?>
|
||||
<nav class="social">
|
||||
<?php foreach ($about->social()->toStructure() as $social): ?>
|
||||
<a href="<?= $social->url() ?>"><?= $social->platform() ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
<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()->html() ?></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>
|
||||
|
@@ -1,12 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Snippets are a great way to store code snippets for reuse or to keep your templates clean.
|
||||
* in loops or simply to keep your templates clean.
|
||||
* This gallery snippet is used in the gallery plugin (`/site/plugins/gallery`)
|
||||
* More about snippets: https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
This gallery snippet is used in the gallery plugin (`/site/plugins/gallery`)
|
||||
|
||||
More about snippets:
|
||||
https://getkirby.com/docs/guide/templates/snippets
|
||||
*/
|
||||
?>
|
||||
<section class="gallery">
|
||||
<?php foreach ($gallery->images() as $image): ?>
|
||||
<figure>
|
||||
|
@@ -1,42 +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
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
<!doctype html>
|
||||
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">
|
||||
|
||||
<!-- The title tag we show the title of our site and the title of the current page -->
|
||||
<?php
|
||||
/*
|
||||
In the title tag we show the title of our
|
||||
site and the title of the current page
|
||||
*/
|
||||
?>
|
||||
<title><?= $site->title() ?> | <?= $page->title() ?></title>
|
||||
|
||||
<!-- 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/index.css', '@auto']) ?>
|
||||
<?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>
|
||||
|
||||
<div class="page">
|
||||
<header class="header">
|
||||
<!-- In this link we call `$site->url()` to create a link back to the homepage -->
|
||||
<a class="logo" href="<?= $site->url() ?>"><?= $site->title() ?></a>
|
||||
<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() ?>
|
||||
</a>
|
||||
|
||||
<nav id="menu" 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
|
||||
foreach ($site->children()->listed() as $item): ?>
|
||||
<?= $item->title()->link() ?>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
</header>
|
||||
<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 ') ?> href="<?= $item->url() ?>"><?= $item->title()->html() ?></a>
|
||||
<?php endforeach ?>
|
||||
<?php snippet('social') ?>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main class="main">
|
||||
|
@@ -1,13 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Snippets are a great way to store code snippets for reuse or to keep your templates clean.
|
||||
* in loops or simply 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
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Snippets are a great way to store code snippets for reuse
|
||||
or to keep your templates clean.
|
||||
|
||||
<header class="intro">
|
||||
<h1><?= $page->title() ?></h1>
|
||||
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())->html() ?></h1>
|
||||
<?php if ($page->subheadline()->isNotEmpty()): ?>
|
||||
<p class="color-grey"><?= $page->subheadline()->html() ?></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
|
23
site/snippets/layouts.php
Executable file
23
site/snippets/layouts.php
Executable 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="<?= $layout->id() ?>" style="--gutter: 1.5rem">
|
||||
<?php foreach ($layout->columns() as $column): ?>
|
||||
<div class="column" style="--columns:<?= $column->span() ?>">
|
||||
<div class="text">
|
||||
<?= $column->blocks() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endforeach ?>
|
30
site/snippets/note.php
Executable file
30
site/snippets/note.php
Executable 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()): ?>
|
||||
<?= $cover->crop(320, 180) ?>
|
||||
<?php endif ?>
|
||||
</figure>
|
||||
|
||||
<h2 class="note-excerpt-title"><?= $note->title() ?></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
Executable file
26
site/snippets/pagination.php
Executable 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
Executable file
27
site/snippets/prevnext.php
Executable 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>
|
24
site/snippets/social.php
Executable file
24
site/snippets/social.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<?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://twitter.com/getkirby">
|
||||
<?= svg('assets/icons/twitter.svg') ?>
|
||||
</a>
|
||||
<a href="https://chat.getkirby.com">
|
||||
<?= svg('assets/icons/discord.svg') ?>
|
||||
</a>
|
||||
<a href="https://instagram.com/getkirby">
|
||||
<?= svg('assets/icons/instagram.svg') ?>
|
||||
</a>
|
||||
</span>
|
@@ -1,61 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* This example templates only echos the field values from the content file and doesn't need any special logic from a controller.
|
||||
* Snippets like the header, footer and intro contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This about page example uses the content from our layout field
|
||||
to create most parts of the page and keeps it modular. Only the
|
||||
contact box at the bottom is pre-defined with a set of fields
|
||||
in the about.yml blueprint.
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php snippet('header') ?>
|
||||
<?php snippet('intro') ?>
|
||||
<?php snippet('layouts', ['field' => $page->layout()]) ?>
|
||||
|
||||
<main>
|
||||
<?php snippet('intro') ?>
|
||||
|
||||
<div class="layout">
|
||||
|
||||
<aside>
|
||||
<section>
|
||||
<h2>Address</h2>
|
||||
<div class="text">
|
||||
<?= $page->address()->kt() ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Email</h2>
|
||||
<div class="text">
|
||||
<?= html::email($page->email()) ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Phone</h2>
|
||||
<div class="text">
|
||||
<?= html::tel($page->phone()) ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>On the web</h2>
|
||||
<div class="text">
|
||||
<ul>
|
||||
<?php foreach ($page->social()->toStructure() as $social): ?>
|
||||
<li><?= html::a($social->url(), $social->platform()) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
</aside>
|
||||
|
||||
<div class="text">
|
||||
<?= $page->text()->kt() ?>
|
||||
</div>
|
||||
<aside class="contact">
|
||||
<h2 class="h1">Get in contact</h2>
|
||||
<div class="grid" style="--gutter: 1.5rem">
|
||||
<section class="column text" style="--columns: 4">
|
||||
<h3>Address</h2>
|
||||
<?= $page->address()->kt() ?>
|
||||
</section>
|
||||
<section class="column text" style="--columns: 4">
|
||||
<h3>Email</h2>
|
||||
<p><?= html::email($page->email()) ?></p>
|
||||
<h3>Phone</h2>
|
||||
<p><?= html::tel($page->phone()) ?></p>
|
||||
</section>
|
||||
<section class="column text" style="--columns: 4">
|
||||
<h3>On the web</h2>
|
||||
<ul>
|
||||
<?php foreach ($page->social()->toStructure() as $social): ?>
|
||||
<li><?= html::a($social->url(), $social->platform()) ?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
</aside>
|
||||
|
||||
</div>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,55 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* This example template makes use of the `$gallery` variable defined in the `album.php` controller
|
||||
* and the `cover()` method defined in the `album.php` page model.
|
||||
* Snippets like the header and footer contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This example template makes use of the `$gallery` variable defined
|
||||
in the `album.php` controller (/site/controllers/album.php)
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
<?php snippet('header') ?>
|
||||
<article>
|
||||
<?php snippet('intro') ?>
|
||||
<div class="grid">
|
||||
|
||||
<main class="album">
|
||||
<article>
|
||||
|
||||
<header>
|
||||
<?php
|
||||
// in this line of code, `cover` does not call the field of the same name but the `cover` method defined in the page model
|
||||
// before we use the `crop()` file method, we make sure to check if the file exists to prevent errors
|
||||
if ($cover = $page->cover()): ?>
|
||||
<figure class="album-cover">
|
||||
<?= $cover->crop(1024, 768) ?>
|
||||
<figcaption>
|
||||
<!-- The `or()` method is great to provide a fallback value if a field is empty -->
|
||||
<h1><?= $page->headline()->or($page->title()) ?></h1>
|
||||
</figcaption>
|
||||
</figure>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
|
||||
<div class="album-text text">
|
||||
<?= $page->description()->kt() ?>
|
||||
|
||||
<?php if ($page->tags()->isNotEmpty()): ?>
|
||||
<p class="album-tags tags"><?= $page->tags() ?></p>
|
||||
<?php endif ?>
|
||||
<div class="column" style="--columns: 4">
|
||||
<div class="text">
|
||||
<?= $page->text() ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ul class="album-gallery"<?= attr(['data-even' => $gallery->isEven(), 'data-count' => $gallery->count()], ' ') ?>>
|
||||
<?php foreach ($gallery as $image): ?>
|
||||
<li>
|
||||
<figure>
|
||||
<a href="<?= $image->link()->or($image->url()) ?>">
|
||||
<?= $image->crop(800, 1000) ?>
|
||||
<div class="column" style="--columns: 8">
|
||||
<ul class="album-gallery">
|
||||
<?php foreach ($gallery as $image): ?>
|
||||
<li>
|
||||
<a href="<?= $image->url() ?>" data-lightbox>
|
||||
<figure class="img" style="--w:<?= $image->width() ?>;--h:<?= $image->height() ?>">
|
||||
<?= $image->resize(800) ?>
|
||||
</figure>
|
||||
</a>
|
||||
</figure>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</article>
|
||||
</main>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</article>
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,22 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`. *
|
||||
* This default template must not be removed. It is used whenever Kirby cannot find a template with the name of the content file.
|
||||
* Snippets like the header, footer and intro contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This default template must not be removed. It is used whenever Kirby
|
||||
cannot find a template with the name of the content file.
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
<?php snippet('header') ?>
|
||||
|
||||
<main>
|
||||
<?php snippet('intro') ?>
|
||||
|
||||
<article>
|
||||
<h1 class="h1"><?= $page->title() ?></h1>
|
||||
<div class="text">
|
||||
<?= $page->text()->kt() ?>
|
||||
</div>
|
||||
</main>
|
||||
</article>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,34 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* This home template renders content from others pages, the children of the `photography` page to display a nice gallery grid.
|
||||
* Snippets like the header and footer contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This home template renders content from others pages, the children of
|
||||
the `photography` page to display a nice gallery grid.
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php snippet('header') ?>
|
||||
|
||||
<main>
|
||||
<?php snippet('intro') ?>
|
||||
|
||||
|
||||
<?php
|
||||
// we always use an if-statement to check if a page exists to prevent errors
|
||||
// in case the page was deleted or renamed before we call a method like `children()` in this case
|
||||
if ($photographyPage = page('photography')): ?>
|
||||
<ul class="grid">
|
||||
<?php
|
||||
/*
|
||||
We always use an if-statement to check if a page exists to
|
||||
prevent errors in case the page was deleted or renamed before
|
||||
we call a method like `children()` in this case
|
||||
*/
|
||||
?>
|
||||
<?php if ($photographyPage = page('photography')): ?>
|
||||
<ul class="home-grid">
|
||||
<?php foreach ($photographyPage->children()->listed() as $album): ?>
|
||||
<li>
|
||||
<a href="<?= $album->url() ?>">
|
||||
<figure>
|
||||
<?php
|
||||
// the `cover()` method defined in the `album.php` page model can be used
|
||||
// everywhere across the site for this type of page
|
||||
if ($cover = $album->cover()): ?>
|
||||
<?php
|
||||
/*
|
||||
The `cover()` method defined in the `album.php`
|
||||
page model can be used everywhere across the site
|
||||
for this type of page
|
||||
|
||||
We can automatically resize images to a useful
|
||||
size with Kirby's built-in image manipulation API
|
||||
*/
|
||||
?>
|
||||
<?php if ($cover = $album->cover()): ?>
|
||||
<?= $cover->resize(1024, 1024) ?>
|
||||
<?php endif ?>
|
||||
<figcaption>
|
||||
@@ -42,7 +57,4 @@
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
||||
</main>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,31 +1,59 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* This template is responsible for rendering all the subpages of the `notes` page.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* Snippets like the header and footer contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This note template renders a blog article. It uses the `$page->cover()`
|
||||
method from the `note.php` page model (/site/models/page.php)
|
||||
|
||||
It also receives the `$tag` variable from its controller
|
||||
(/site/controllers/note.php) if a tag filter is activated.
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
<?php snippet('header') ?>
|
||||
|
||||
<main>
|
||||
<article class="note">
|
||||
<header class="note-header intro">
|
||||
<h1><?= $page->title() ?></h1>
|
||||
<time class="note-date"><?= $page->date()->toDate('d F Y') ?></time>
|
||||
<?php if ($page->tags()->isNotEmpty()) : ?>
|
||||
<p class="note-tags tags"><?= $page->tags() ?></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
<?php if ($cover = $page->cover()): ?>
|
||||
<a href="<?= $cover->url() ?>" data-lightbox class="img" style="--w:2; --h:1">
|
||||
<?= $cover->crop(1200, 600) ?>
|
||||
</a>
|
||||
<?php endif ?>
|
||||
|
||||
<div class="note-text text">
|
||||
<?= $page->text()->kt() ?>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
<article class="note">
|
||||
<header class="note-header h1">
|
||||
<h1 class="note-title"><?= $page->title() ?></h1>
|
||||
<?php if ($page->subheading()->isNotEmpty()): ?>
|
||||
<p class="note-subheading"><small><?= $page->subheading() ?></small></p>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
<div class="note text">
|
||||
<?= $page->text()->toBlocks() ?>
|
||||
</div>
|
||||
<footer class="note-footer">
|
||||
<?php if (!empty($tags)): ?>
|
||||
<ul class="note-tags">
|
||||
<?php foreach ($tags as $tag): ?>
|
||||
<li>
|
||||
<a href="<?= $page->parent()->url(['params' => ['tag' => $tag]]) ?>"><?= $tag ?></a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php endif ?>
|
||||
|
||||
<time class="note-date" datetime="<?= $page->date('c') ?>">Published on <?= $page->date() ?></time>
|
||||
</footer>
|
||||
|
||||
<?php snippet('prevnext') ?>
|
||||
</article>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,34 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* This template lists all all the subpages of the `notes` page with their title date sorted by date and links to each subpage.
|
||||
* Snippets like the header, footer and intro contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This template lists all the subpages of the `notes` page with
|
||||
their title date sorted by date and links to each subpage.
|
||||
|
||||
This template receives additional variables like $tag and $notes
|
||||
from the `notes.php` controller in `/site/controllers/notes.php`
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
<?php snippet('header') ?>
|
||||
|
||||
<main>
|
||||
<?php if (empty($tag) === false): ?>
|
||||
<header class="h1">
|
||||
<h1>
|
||||
<small>Tag:</small> <?= html($tag) ?>
|
||||
<a href="<?= $page->url() ?>">×</a>
|
||||
</h1>
|
||||
</header>
|
||||
<?php else: ?>
|
||||
<?php snippet('intro') ?>
|
||||
<?php endif ?>
|
||||
|
||||
<ul class="grid">
|
||||
<?php foreach ($notes as $note): ?>
|
||||
<li class="column" style="--columns: 4">
|
||||
<?php snippet('note', ['note' => $note]) ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
|
||||
<div class="notes">
|
||||
<?php foreach ($page->children()->listed()->sortBy('date', 'desc') as $note): ?>
|
||||
<article class="note">
|
||||
<header class="note-header">
|
||||
<a href="<?= $note->url() ?>">
|
||||
<h2><?= $note->title() ?></h2>
|
||||
<time><?= $note->date()->toDate('d F Y') ?></time>
|
||||
</a>
|
||||
</header>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
|
||||
</main>
|
||||
|
||||
<?php snippet('pagination', ['pagination' => $notes->pagination()]) ?>
|
||||
<?php snippet('footer') ?>
|
||||
|
@@ -1,35 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Templates render the content of your pages.
|
||||
* They contain the markup together with some control structures like loops or if-statements.
|
||||
* The `$page` variable always refers to the currently active page.
|
||||
* To fetch the content from each field we call the field name as a method on the `$page` object, e.g. `$page->title()`.
|
||||
* This template lists all all the subpages of the `phototography` page with title and cover image.
|
||||
* Snippets like the header, footer and intro contain markup used in multiple templates. They also help to keep templates clean.
|
||||
* More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
/*
|
||||
Templates render the content of your pages.
|
||||
|
||||
They contain the markup together with some control structures
|
||||
like loops or if-statements. The `$page` variable always
|
||||
refers to the currently active page.
|
||||
|
||||
To fetch the content from each field we call the field name as a
|
||||
method on the `$page` object, e.g. `$page->title()`.
|
||||
|
||||
This template lists all all the subpages of the `phototography`
|
||||
page with title and cover image.
|
||||
|
||||
Snippets like the header and footer contain markup used in
|
||||
multiple templates. They also help to keep templates clean.
|
||||
|
||||
More about templates: https://getkirby.com/docs/guide/templates/basics
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php snippet('header') ?>
|
||||
<?php snippet('intro') ?>
|
||||
|
||||
<main>
|
||||
<?php snippet('intro') ?>
|
||||
|
||||
|
||||
<ul class="albums"<?= attr(['data-even' => $page->children()->listed()->isEven()], ' ') ?>>
|
||||
<?php foreach ($page->children()->listed() as $album): ?>
|
||||
<li>
|
||||
<a href="<?= $album->url() ?>">
|
||||
<figure>
|
||||
<?php if ($cover = $album->cover()): ?>
|
||||
<?= $cover->crop(800, 1000) ?>
|
||||
<?php endif ?>
|
||||
<figcaption><?= $album->title() ?></figcaption>
|
||||
</figure>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</main>
|
||||
<ul class="grid" style="--gutter: 1.5rem">
|
||||
<?php foreach ($page->children()->listed() as $project): ?>
|
||||
<li class="column" style="--columns: 3">
|
||||
<a href="<?= $project->url() ?>">
|
||||
<figure>
|
||||
<span class="img" style="--w:4;--h:5">
|
||||
<?= ($cover = $project->cover()) ? $cover->crop(400, 500) : null ?>
|
||||
</span>
|
||||
<figcaption class="img-caption">
|
||||
<?= $project->title()->html() ?>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
|
||||
<?php snippet('footer') ?>
|
||||
|
Reference in New Issue
Block a user