|
1 | 1 | # Change Log |
2 | 2 | All notable changes to this project will be documented in this file. |
3 | 3 |
|
| 4 | +## [1.0.0] - 2017-11-15 |
| 5 | +The previous version has been stable enough and no issue has been reported in 8 months :smiley: |
| 6 | + |
| 7 | +I finally got time to make some improvements and update the documentation so it's time to release [v1.0.0](https://github.com/pedroborges/kirby-meta-tags/tree/v1.0.0). |
| 8 | + |
| 9 | +### Changed |
| 10 | +- Options `meta-tags.default` and `meta-tags.templates` can now return a `closure` which receives `$page` and `$site` as arguments: |
| 11 | + |
| 12 | + ```php |
| 13 | + c::set('meta-tags.default', function(Page $page, Site $site) { |
| 14 | + return [ |
| 15 | + 'title' => $site->title(), |
| 16 | + 'meta' => [ |
| 17 | + 'description' => $site->description() |
| 18 | + ], |
| 19 | + 'link' => [ |
| 20 | + 'canonical' => $page->url() |
| 21 | + ], |
| 22 | + 'og' => [ |
| 23 | + 'title' => $page->isHomePage() |
| 24 | + ? $site->title() |
| 25 | + : $page->title(), |
| 26 | + 'type' => 'website', |
| 27 | + 'site_name' => $site->title(), |
| 28 | + 'url' => $page->url() |
| 29 | + ] |
| 30 | + ]; |
| 31 | + }); |
| 32 | + ``` |
| 33 | + |
| 34 | +- Closures in other places now receive `$site` and second argument as well: |
| 35 | + |
| 36 | + ```php |
| 37 | + 'link' => [ |
| 38 | + 'canonical' => $page->url(), |
| 39 | + 'alternate' => function(Page $page, Site $site) { |
| 40 | + $locales = []; |
| 41 | + |
| 42 | + foreach ($site->languages() as $language) { |
| 43 | + if ($language->isDefault()) continue; |
| 44 | + |
| 45 | + $locales[] = [ |
| 46 | + 'hreflang' => $language->code(), |
| 47 | + 'href' => $page->url($language->code()) |
| 48 | + ]; |
| 49 | + } |
| 50 | + |
| 51 | + return $locales; |
| 52 | + } |
| 53 | + ], |
| 54 | + ``` |
| 55 | + |
| 56 | +Besides offering a better workflow, these changes also help avoid an issue where `site()` can't be called outside a closure from the config file in multi-language websites, as reported at getkirby/kirby#606. |
| 57 | + |
4 | 58 | ## [1.0.0-beta] - 2017-03-01 |
5 | 59 | The plugin has gone under heavy refactor and is no longer focused only on Open Graph. For that reason the name has changed from Open Graph to Meta Tags. |
6 | 60 |
|
|
0 commit comments