Skip to content

Commit

Permalink
feat: support menu entry in url()
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Oct 20, 2023
1 parent 35e27a5 commit c5e2692
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Assets/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Cecil\Assets;

use Cecil\Builder;
use Cecil\Collection\Menu\Entry as MenuEntry;
use Cecil\Collection\Page\Page;
use Cecil\Config;
use Cecil\Renderer\Page as PageRenderer;
Expand Down Expand Up @@ -99,6 +100,10 @@ public function __construct(Builder $builder, $value, array $options = null)
$this->url = $value->getVariable('canonical')['url'];
}
break;
case $value instanceof MenuEntry:
/** @var MenuEntry $value */
$this->url = $base . '/' . ltrim($value['url'], '/');
break;
case $value instanceof Asset:
/** @var Asset $value */
$this->url = $base . '/' . ltrim($value['path'], '/');
Expand Down

0 comments on commit c5e2692

Please sign in to comment.