Skip to content

Commit

Permalink
Add Route as attribute examples in static routes usage (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
norkunas authored Jan 24, 2022
1 parent ad23fe5 commit 22eb70f
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions doc/3-static-routes-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,44 @@ The supported sitemap parameters are:
> **Note** you can change defaults in the bundle configuration.
> Jump to [dedicated documentation](2-configuration.md) for more information.
## Attribute

```php
<?php

namespace App\Controller;

use Presta\SitemapBundle\Sitemap\Url\UrlConcrete;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Routing\Route;

class DefaultController extends Controller
{
#[Route('/', name: 'homepage', options: ['sitemap' => true])]
public function indexAction()
{
//...
}

#[Route('/faq', name: 'faq', options: ['sitemap' => ['priority' => 0.7]])]
public function faqAction()
{
//...
}

#[Route('/about', name: 'about', options: ['sitemap' => ['priority' => 0.7, 'changefreq' => UrlConcrete::CHANGEFREQ_WEEKLY]])]
public function aboutAction()
{
//...
}

#[Route('/contact', name: 'contact', options: ['sitemap' => ['priority' => 0.7, 'changefreq' => UrlConcrete::CHANGEFREQ_WEEKLY, 'section' => 'misc']])]
public function contactAction()
{
//...
}
}
```

## Annotation

Expand Down

0 comments on commit 22eb70f

Please sign in to comment.