changeset 1085:3d71cd95f90a

sources: Fix index page slug for ordered page source.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 15 Feb 2018 22:27:11 -0800
parents e135fd873c45
children 84e1d2c587ae
files piecrust/sources/autoconfig.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/piecrust/sources/autoconfig.py	Thu Feb 15 22:26:26 2018 -0800
+++ b/piecrust/sources/autoconfig.py	Thu Feb 15 22:27:11 2018 -0800
@@ -103,6 +103,7 @@
             for f in filenames:
                 slug, _ = os.path.splitext(f)
                 if slug == route_slug:
+                    path = os.path.join(dirpath, f)
                     metadata = self._createItemMetadata(path)
                     path = os.path.join(dirpath, f)
                     rel_path = os.path.relpath(path, self.fs_endpoint_path)
@@ -203,7 +204,10 @@
 
     def _makeSlug(self, path):
         slug = super()._makeSlug(path)
-        return self.re_pattern.sub(r'\1', slug)
+        slug = self.re_pattern.sub(r'\1', slug)
+        if slug == '_index':
+            slug = ''
+        return slug
 
 
 class OrderTrailSortIterator(object):