> For the complete documentation index, see [llms.txt](https://metabolism.gitbook.io/symfony-wordpress-bundle/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://metabolism.gitbook.io/symfony-wordpress-bundle/reference/service/breacrumbservice.md).

# BreacrumbService

Retrieve ancestors links for single page

## Methods

#### build($args)

| Property     | Default |
| ------------ | ------- |
| add\_home    | `true`  |
| add\_current | `true`  |
| data         | `[]`    |

{% hint style="info" %}
Use `data` to add pages between homepage and current
{% endhint %}

## Exemple

Controller

```php
public function articleThematicAction(array $posts, PostRepository $postRepository, BreadcrumbService $breadcrumbService)
{
  $context = ['posts'=>$posts];
  $context['breadcrumb'] = $breadcrumbService->build();
  
  return $this->render('page/term.twig', $context);
}
```

View

```liquid
{% set breadcrumb = breadcrumb|default(blog.breadcrumb) %}
{% if breadcrumb %}
<ul>
  {% for page in breadcrumb %}
    <li>
      {% if not loop.last %}
        <a href="{{ page.link }}">{{ page.title }}</a>
      {% else %}
        {{ page.title }}
      {% endif %}
    </li>
  {% endfor %}
</ul>
{% endif %}
```
