Fix Agora indexing after move to node-to-template.

This commit is contained in:
Flancian 2020-12-27 20:53:11 +01:00
parent b2402c34d7
commit dc3db05078
2 changed files with 3 additions and 2 deletions

View file

@ -31,6 +31,7 @@ G = db.G
def index():
node='index'
n = G.node(node)
n.subnodes = util.rank(n.subnodes, user='agora')
return render_template(
'node_rendered.html',
node=n,

View file

@ -80,10 +80,10 @@ class Graph:
# does this belong here?
@cachetools.func.ttl_cache(maxsize=1, ttl=20)
def subnodes(self, sort=True):
def subnodes(self, sort=lambda x: x.uri.lower()):
subnodes = [Subnode(f) for f in glob.glob(os.path.join(config.AGORA_PATH, '**/*.md'), recursive=True)]
if sort:
return sorted(subnodes, key=lambda x: x.uri.lower())
return sorted(subnodes, key=sort)
else:
return subnodes