Skip to content

Commit

Permalink
Improved Readme
Browse files Browse the repository at this point in the history
Additional Documenation for Configuration and Use

Signed-off-by: Justin Yost <self@justinyost.com>
  • Loading branch information
justinyost committed May 26, 2016
1 parent 52c1915 commit c5d8948
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,53 @@ Configure::write('Sitemap.tables', [

* Add the `Sitemap.Sitemap` Behavior to each table as well

```php
$this->addBehavior('Sitemap.Sitemap');
```

### Configuration

* Default configuration options for the `Sitemap` Behavior is:

```php
'cacheConfigKey' => 'default',
'lastmod' => 'modified',
'changefreq' => 'daily',
'priority' => '0.9',
'conditions' => [],
'order' => [],
'fields' => [],
'implementedMethods' => [
'getUrl' => 'returnUrlForEntity',
],
'implementedFinders' => [
'forSitemap' => 'findSitemapRecords',
],
```

* To modify these options for instance to change the `changefreq` when listing records, updated the `addBehavior` method call for the `Table` in question like so:

```php
$this->addBehavior('Sitemap.Sitemap', ['changefreq' => 'weekly']);
```

* To customize the url generated for each record create a method named `getUrl` in the matching `Table` class.

```
public function getUrl(\App\Model\Entity $entity) {
return \Cake\Routing\Router::url(
[
'prefix' => false,
'plugin' => false,
'controller' => $this->registryAlias(),
'action' => 'display',
$entity->display_id,
],
true
);
}
```

## Contributing

### Code of Conduct
Expand Down

0 comments on commit c5d8948

Please sign in to comment.