mirror of
https://github.com/getgrav/grav.git
synced 2025-12-05 23:39:58 +01:00
fix for markdown images/links in pages with slug override
This commit is contained in:
@@ -128,7 +128,6 @@ class Grav extends Container
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// If no page found, fire event
|
// If no page found, fire event
|
||||||
$event = $c->fireEvent('onPageNotFound');
|
$event = $c->fireEvent('onPageNotFound');
|
||||||
|
|
||||||
|
|||||||
@@ -210,16 +210,16 @@ trait ParsedownGravTrait
|
|||||||
{
|
{
|
||||||
// if absolute and starts with a base_url move on
|
// if absolute and starts with a base_url move on
|
||||||
if ($this->base_url != '' && strpos($markdown_url, $this->base_url) === 0) {
|
if ($this->base_url != '' && strpos($markdown_url, $this->base_url) === 0) {
|
||||||
$new_url = $markdown_url;
|
return $markdown_url;
|
||||||
// if its absolute and starts with /
|
// if its absolute and starts with /
|
||||||
} elseif (strpos($markdown_url, '/') === 0) {
|
} elseif (strpos($markdown_url, '/') === 0) {
|
||||||
$new_url = $this->base_url . $markdown_url;
|
return $this->base_url . $markdown_url;
|
||||||
} else {
|
} else {
|
||||||
$relative_path = $this->base_url . $this->page->route();
|
$relative_path = $this->base_url . $this->page->route();
|
||||||
|
$real_path = $this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH);
|
||||||
|
|
||||||
// If this is a 'real' filepath clean it up
|
// strip numeric order from markdown path
|
||||||
if (file_exists($this->page->path() . '/' . parse_url($markdown_url, PHP_URL_PATH))) {
|
if (($real_path)) {
|
||||||
$relative_path = $this->base_url . preg_replace('/\/([\d]+\.)/', '/', str_replace($this->pages_dir, '', $this->page->path()));
|
|
||||||
$markdown_url = preg_replace('/^([\d]+\.)/', '', preg_replace('/\/([\d]+\.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/')));
|
$markdown_url = preg_replace('/^([\d]+\.)/', '', preg_replace('/\/([\d]+\.)/', '/', trim(preg_replace('/[^\/]+(\.md$)/', '', $markdown_url), '/')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user