Example #1
0
 /**
  * [pages description]
  * @param  [type] $folder [description]
  * @return [type]         [description]
  */
 public static function pages($folder)
 {
     if (strpos($folder, ':') === false && !self::$app->isAbsolutePath($folder)) {
         $path = "content:{$folder}";
     } else {
         $path = $folder;
     }
     return \Copilot\PageCollection::fromFolder($path);
 }
Example #2
0
 /**
  * [siblings description]
  * @return [type]
  */
 public function siblings($filter = null)
 {
     if ($this->isIndex()) {
         if ($this->isRootIndex()) {
             $collection = new PageCollection([]);
         } else {
             $collection = PageCollection::fromFolder(dirname($this->dir))->not($this);
         }
     } else {
         $collection = PageCollection::fromFolder($this->dir)->not($this);
         if (!$this->isIndex()) {
             $collection = $collection->not($this->parent());
         }
     }
     // apply filter
     if ($filter && $collection->count()) {
         $collection = $collection->filter($filter);
     }
     return $collection;
 }