Support configuration of query defaults
Change-Id: I04b2077d3b803795f070268687103c557d81606a
diff --git a/lib/Kalamar.pm b/lib/Kalamar.pm
index c93042f..e37b0d8 100644
--- a/lib/Kalamar.pm
+++ b/lib/Kalamar.pm
@@ -319,6 +319,18 @@
};
};
+ # Set defaults per config
+ $self->defaults(
+ items_per_page => 25,
+ context => '40-t,40-t', # Before: 'base/s:p'/'paragraph'
+ );
+
+ if (exists $conf->{defaults}) {
+ my $def = $conf->{defaults};
+ $self->defaults(items_per_page => $def->{items_per_page}) if $def->{items_per_page};
+ $self->defaults(context => $def->{context}) if $def->{context};
+ };
+
# Configure documentation navigation
my $doc_navi = Mojo::File->new($self->home->child('templates','doc','navigation.json'))->slurp;
$doc_navi = $doc_navi ? decode_json($doc_navi) : [];