Jelajahi Sumber

Drop inaccessible pages

e.g. drop sub.md if sub/index.md exists
Daniel Rudolf 9 tahun lalu
induk
melakukan
95db5ba1a1
1 mengubah file dengan 7 tambahan dan 0 penghapusan
  1. 7 0
      lib/Pico.php

+ 7 - 0
lib/Pico.php

@@ -726,6 +726,13 @@ class Pico
                 $meta = &$this->meta;
                 $meta = &$this->meta;
             }
             }
 
 
+            // drop inaccessible pages (e.g. drop "sub.md" if "sub/index.md" exists)
+            if (substr($id, -6) === '/index') {
+                unset($pages[dirname($id)]);
+            } elseif (isset($pages[$id . '/index'])) {
+                continue;
+            }
+
             // build page data
             // build page data
             // title, description, author and date are assumed to be pretty basic data
             // title, description, author and date are assumed to be pretty basic data
             // everything else is accessible through $page['meta']
             // everything else is accessible through $page['meta']