Add correct Page::$slug

This commit is contained in:
Giuseppe Criscione 2019-03-14 19:44:54 +01:00
parent e683a89291
commit 64c7105b82

View File

@ -54,6 +54,13 @@ class Page extends AbstractPage
*/ */
protected $id; protected $id;
/**
* Page slug
*
* @var string
*/
protected $slug;
/** /**
* Page filename * Page filename
* *
@ -125,6 +132,7 @@ class Page extends AbstractPage
$this->route = Uri::normalize(preg_replace('~/(\d+-)~', '/', $this->relativePath)); $this->route = Uri::normalize(preg_replace('~/(\d+-)~', '/', $this->relativePath));
$this->uri = HTTPRequest::root() . ltrim($this->route, '/'); $this->uri = HTTPRequest::root() . ltrim($this->route, '/');
$this->id = FileSystem::basename($this->path); $this->id = FileSystem::basename($this->path);
$this->slug = FileSystem::basename($this->route);
$this->loadFiles(); $this->loadFiles();
if (!$this->isEmpty()) { if (!$this->isEmpty()) {
$this->parse(); $this->parse();