date()->toDate('Y/m/d'); return '/' . $date .'/' . $this->slug(); } public function readingTime(): string { $doc = new DOMDocument(); $doc->loadHTML( '
' . $this->text()->kirbytext() . '' ); $pElems = $doc->getElementsByTagName('p'); $text = ''; foreach ($pElems as $pElem) { $text .= $pElem->nodeValue . ' '; } $wordCount = count(explode(' ', $text)); $readingTime = (int)ceil($wordCount / 150); return sprintf(self::READING_TIME_FORMAT, $wordCount, $readingTime); } }