Skip to content

Commit

Permalink
Remove language prefix from index path when determining the template …
Browse files Browse the repository at this point in the history
…to use.
  • Loading branch information
yaph committed Feb 23, 2019
1 parent cdd5d4b commit 2a6e021
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions logya/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ def get_index_template(self, fullpath):
"""

template = self.templates['index']
var = get_collection_var(fullpath, self.collection_index)
if var:
template = self.config['collections'][var].get('template', template)
attr = get_collection_var(fullpath, self.collection_index)

# Remove top-level language directory from fullpath if inside that language, so the definitions in site.yaml can be matched.
if not attr and self.languages:
for lang in self.languages:
prefix = lang['code'] + '/'
if fullpath.startswith(prefix):
attr = get_collection_var(fullpath[len(prefix):], self.collection_index)
break
if attr:
template = self.config['collections'][attr].get('template', template)
return template

def _update_index(self, doc, url=None):
Expand Down

0 comments on commit 2a6e021

Please sign in to comment.