Skip to content

Commit 9002f5a

Browse files
Merge pull request #33 from Daandelange/page-method-is-indexed
Page method is indexed
2 parents 23f2f8f + 55ea3a4 commit 9002f5a

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,15 @@ return [
281281
];
282282
```
283283

284+
### Manipulating indexed pages
285+
A few helpers are available for manipulating pages :
286+
287+
### Page Method
288+
If you'd like to know if a page is indexed in the sitemap, you can use `$page->isIndexible()` (returns a `bool`).
289+
290+
### Site Method
291+
To get all indexed pages according to your settings, you can use : `$site->indexedPages()` (returns a `Kirby\Cms\Collection` of pages).
292+
284293
## Credits
285294

286295
This is partly based on an older version of the meta plugin, that I had initially

config/page-methods.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
<?php
22

33
use FabianMichael\Meta\PageMeta;
4+
use FabianMichael\Meta\SiteMap;
45

56
return [
67
'meta' => function (?string $languageCode = null) {
78
return PageMeta::of($this, $languageCode);
89
},
10+
11+
'isIndexible' => function(){
12+
return Sitemap::isPageIndexible( $this );
13+
},
914
];

config/site-methods.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,7 @@
1717
return '<span data-theme="notice" class="k-meta-warning-box">' . $text . '</span>';
1818
}
1919
},
20+
'indexedPages' => function () {
21+
return kirby()->site()->index()->filterBy('isIndexible', '==', true);
22+
},
2023
];

0 commit comments

Comments
 (0)