Compare commits
No commits in common. "b36abcd3bffaabc0216928d3af5fb9371e3f9dd9" and "d10e8209c61899c233de4fd663fd795781fe79c8" have entirely different histories.
b36abcd3bf
...
d10e8209c6
13 changed files with 8 additions and 91 deletions
|
@ -1,5 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
return [
|
|
||||||
'debug' => true
|
|
||||||
];
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Kirby\Cms\Page;
|
return function ($page, $tag, $category) {
|
||||||
|
|
||||||
return function (Page $page, ?string $tag, ?string $category): array {
|
|
||||||
$articles = $page->children()->listed();
|
$articles = $page->children()->listed();
|
||||||
|
|
||||||
if ($tag) {
|
if ($tag) {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Kirby\Cms\Page;
|
return function ($page) {
|
||||||
|
|
||||||
return function (Page $page): array {
|
|
||||||
return [
|
return [
|
||||||
'quotes' => $page->children()->listed()->flip()->paginate(20)
|
'quotes' => $page->children()->listed()->flip()->paginate(20)
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,33 +1,19 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Kirby\Cms\Page;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @method object categories()
|
|
||||||
* @method object tags()
|
|
||||||
* @method object date()
|
|
||||||
* @method object text()
|
|
||||||
*/
|
|
||||||
class ArticlePage extends Page
|
class ArticlePage extends Page
|
||||||
{
|
{
|
||||||
private const READING_TIME_FORMAT = '%d words, ~%d min reading time';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array|string|null $options
|
|
||||||
*/
|
|
||||||
public function url($options = null): string
|
public function url($options = null): string
|
||||||
{
|
{
|
||||||
$date = $this->date()->toDate('Y/m/d');
|
$date = $this->date()->toDate('Y/m/d');
|
||||||
return '/' . $date .'/' . $this->slug();
|
return '/' . $date .'/' . $this->slug();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function readingTime(): string
|
public function readingTime() {
|
||||||
{
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->loadHTML(
|
$doc->loadHtml(
|
||||||
'<html><head><meta charset="UTF-8"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body>'
|
"<html><head><meta charset=\"UTF-8\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body>"
|
||||||
. $this->text()->kirbytext()
|
. $this->text()->kirbytext()
|
||||||
. '</body></html>'
|
."</body></html>"
|
||||||
);
|
);
|
||||||
$pElems = $doc->getElementsByTagName('p');
|
$pElems = $doc->getElementsByTagName('p');
|
||||||
|
|
||||||
|
@ -39,6 +25,6 @@ class ArticlePage extends Page
|
||||||
$wordCount = count(explode(' ', $text));
|
$wordCount = count(explode(' ', $text));
|
||||||
$readingTime = (int)ceil($wordCount / 150);
|
$readingTime = (int)ceil($wordCount / 150);
|
||||||
|
|
||||||
return sprintf(self::READING_TIME_FORMAT, $wordCount, $readingTime);
|
return $wordCount . ' words, ~' . $readingTime . 'min reading time';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var bool $main
|
|
||||||
* @var ArticlePage $article
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<article>
|
<article>
|
||||||
<?php if ($main): ?>
|
<?php if ($main): ?>
|
||||||
<h2><a href="<?= $article->url() ?>"><?= $article->title() ?></a></h2>
|
<h2><a href="<?= $article->url() ?>"><?= $article->title() ?></a></h2>
|
||||||
|
|
|
@ -1,11 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Site $site
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
* @var string $slot
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en-US">
|
<html lang="en-US">
|
||||||
<head>
|
<head>
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<h1><?= $page->title() ?></h1>
|
<h1><?= $page->title() ?></h1>
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<h1><?= $page->title() ?></h1>
|
<h1><?= $page->title() ?></h1>
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
* @var Kirby\Cms\Pages $articles
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<h1><?= $page->title() ?></h1>
|
<h1><?= $page->title() ?></h1>
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Kirby $kirby
|
|
||||||
* @var Kirby\Cms\Site $site
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
*/
|
|
||||||
|
|
||||||
$kirby->response()->type('application/rss+xml');
|
$kirby->response()->type('application/rss+xml');
|
||||||
|
|
||||||
|
@ -50,7 +45,6 @@ $writer->writeElement('link', url());
|
||||||
$writer->endElement(); // image
|
$writer->endElement(); // image
|
||||||
|
|
||||||
foreach ($articles as $article) {
|
foreach ($articles as $article) {
|
||||||
/** @var Kirby\Cms\Page $article */
|
|
||||||
$writer->startElement('item');
|
$writer->startElement('item');
|
||||||
|
|
||||||
$writer->writeElement('title', $article->title()->toString());
|
$writer->writeElement('title', $article->title()->toString());
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<h1><?= $page->title() ?></h1>
|
<h1><?= $page->title() ?></h1>
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Site $site
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<header>
|
<header>
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* @var Kirby\Cms\Page $page
|
|
||||||
* @var Kirby\Cms\Pages $quotes
|
|
||||||
*/
|
|
||||||
?>
|
|
||||||
|
|
||||||
<?php snippet('layout', slots: true) ?>
|
<?php snippet('layout', slots: true) ?>
|
||||||
<?php slot() ?>
|
<?php slot() ?>
|
||||||
<h1><?= $page->title() ?></h1>
|
<h1><?= $page->title() ?></h1>
|
||||||
|
|
Loading…
Add table
Reference in a new issue