diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 189e2bb60..3f7d5c467 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -260,13 +260,6 @@ class Page { $content = $this->content(); - // Handle summary divider - $divider_pos = strpos($content, '

'.SUMMARY_DELIMITER.'

'); - if ($divider_pos !== false) { - $this->summary_size = $divider_pos; - $content = str_replace('

'.SUMMARY_DELIMITER.'

', '', $content); - } - // Return calculated summary based on summary divider's position if (!$size && isset($this->summary_size)) { return substr($content, 0, $this->summary_size); @@ -350,13 +343,20 @@ class Page } } + // Process any post-processing but pre-caching functionality + self::$grav->fireEvent('onPageContentProcessed', new Event(['page' => $this])); + // Cache the whole page, including processed content if ($update_cache) { $cache->save($cache_id, $this->content); } - // Process any post-processing but pre-caching functionality - self::$grav->fireEvent('onPageContentProcessed', new Event(['page' => $this])); + // Handle summary divider + $divider_pos = strpos($this->content, '

'.SUMMARY_DELIMITER.'

'); + if ($divider_pos !== false) { + $this->summary_size = $divider_pos; + $this->content = str_replace('

'.SUMMARY_DELIMITER.'

', '', $this->content); + } }