diff --git a/system/src/Grav/Common/Page/Markdown/Excerpts.php b/system/src/Grav/Common/Page/Markdown/Excerpts.php index 8d7ad16c9..b63ed3972 100644 --- a/system/src/Grav/Common/Page/Markdown/Excerpts.php +++ b/system/src/Grav/Common/Page/Markdown/Excerpts.php @@ -100,6 +100,10 @@ class Excerpts if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) { return $excerpt; } + if (str_starts_with($url, '/-') && str_ends_with($url, '-/')) { + // Twig in markdown + return $excerpt; + } $url_parts = $this->parseUrl($url); @@ -194,6 +198,10 @@ class Excerpts if (Uri::isExternal($url) && !str_starts_with($url, $grav['base_url_absolute'])) { return $excerpt; } + if (str_starts_with($url, '/-') && str_ends_with($url, '-/')) { + // Twig in markdown + return $excerpt; + } $url_parts = $this->parseUrl($url); diff --git a/system/src/Grav/Common/Page/Page.php b/system/src/Grav/Common/Page/Page.php index 6ccb726db..0041a3641 100644 --- a/system/src/Grav/Common/Page/Page.php +++ b/system/src/Grav/Common/Page/Page.php @@ -940,8 +940,8 @@ class Page implements PageInterface $content = $this->content; if ($keepTwig) { $token = [ - '/' . Utils::generateRandomString(3), - Utils::generateRandomString(3) . '/' + '/-' . Utils::generateRandomString(3), + Utils::generateRandomString(3) . '-/' ]; // Base64 encode any twig. $content = preg_replace_callback(