protected function renderCrumbs(): string
    {
        end($this->breadcrumbs);
        $lastKey = key($this->breadcrumbs);

        $output = '';

        $position = 1;

        foreach ($this->breadcrumbs as $key => $crumb) {
            $isLast = ($lastKey === $key);

            $href = $crumb['href'];

            // Add a slash when the URL is relative and does not contain a slash at the start.
            if (!preg_match('#^https?://.*#', $href) && mb_substr($href, 0, 1) !== '/') {
                $href = "/{$href}";
            }

            $output .= $this->renderCrumb($crumb['name'], $href, $isLast, $position);
            $position++;
        }

        return $output;
    }