diff --git a/site/controllers/blog.php b/site/controllers/blog.php index 84071a9..b9f03b9 100644 --- a/site/controllers/blog.php +++ b/site/controllers/blog.php @@ -1,6 +1,8 @@ children()->listed(); if ($tag) { diff --git a/site/controllers/quotes.php b/site/controllers/quotes.php index f8ae4e3..66fd73a 100644 --- a/site/controllers/quotes.php +++ b/site/controllers/quotes.php @@ -1,6 +1,8 @@ $page->children()->listed()->flip()->paginate(20) ]; diff --git a/site/models/article.php b/site/models/article.php index 4ae9b75..cb93c26 100644 --- a/site/models/article.php +++ b/site/models/article.php @@ -1,19 +1,33 @@ date()->toDate('Y/m/d'); return '/' . $date .'/' . $this->slug(); } - public function readingTime() { + public function readingTime(): string + { $doc = new DOMDocument(); - $doc->loadHtml( - "" - . $this->text()->kirbytext() - ."" + $doc->loadHTML( + '' + . $this->text()->kirbytext() + . '' ); $pElems = $doc->getElementsByTagName('p'); @@ -25,6 +39,6 @@ class ArticlePage extends Page $wordCount = count(explode(' ', $text)); $readingTime = (int)ceil($wordCount / 150); - return $wordCount . ' words, ~' . $readingTime . 'min reading time'; + return sprintf(self::READING_TIME_FORMAT, $wordCount, $readingTime); } } diff --git a/site/snippets/article.php b/site/snippets/article.php index b97639b..63f618b 100644 --- a/site/snippets/article.php +++ b/site/snippets/article.php @@ -1,3 +1,10 @@ + +

title() ?>

diff --git a/site/snippets/layout.php b/site/snippets/layout.php index e999c52..b5abe5d 100644 --- a/site/snippets/layout.php +++ b/site/snippets/layout.php @@ -1,3 +1,11 @@ + + diff --git a/site/templates/about.php b/site/templates/about.php index 7a98048..3647285 100644 --- a/site/templates/about.php +++ b/site/templates/about.php @@ -1,3 +1,9 @@ + +

title() ?>

diff --git a/site/templates/article.php b/site/templates/article.php index d5e4b47..dcc8dfe 100644 --- a/site/templates/article.php +++ b/site/templates/article.php @@ -1,3 +1,9 @@ + +

title() ?>

diff --git a/site/templates/blog.php b/site/templates/blog.php index 27395cf..ef44445 100644 --- a/site/templates/blog.php +++ b/site/templates/blog.php @@ -1,3 +1,10 @@ + +

title() ?>

diff --git a/site/templates/blog.rss.php b/site/templates/blog.rss.php index 08a1ec8..ac360dd 100644 --- a/site/templates/blog.rss.php +++ b/site/templates/blog.rss.php @@ -1,4 +1,9 @@ response()->type('application/rss+xml'); @@ -45,6 +50,7 @@ $writer->writeElement('link', url()); $writer->endElement(); // image foreach ($articles as $article) { + /** @var Kirby\Cms\Page $article */ $writer->startElement('item'); $writer->writeElement('title', $article->title()->toString()); diff --git a/site/templates/default.php b/site/templates/default.php index a7c4762..5d2873a 100644 --- a/site/templates/default.php +++ b/site/templates/default.php @@ -1,3 +1,9 @@ + +

title() ?>

diff --git a/site/templates/home.php b/site/templates/home.php index 3b20c57..b2b8e5f 100644 --- a/site/templates/home.php +++ b/site/templates/home.php @@ -1,3 +1,10 @@ + +
diff --git a/site/templates/quotes.php b/site/templates/quotes.php index fa00553..b5af1d1 100644 --- a/site/templates/quotes.php +++ b/site/templates/quotes.php @@ -1,3 +1,10 @@ + +

title() ?>