Adjustments for subdirectory serving (6)
diff --git a/lib/Kalamar/Plugin/KalamarHelpers.pm b/lib/Kalamar/Plugin/KalamarHelpers.pm
index e15470f..79ee0d0 100644
--- a/lib/Kalamar/Plugin/KalamarHelpers.pm
+++ b/lib/Kalamar/Plugin/KalamarHelpers.pm
@@ -16,8 +16,13 @@
my $url = $c->url_with('/img/korap-overview.svg');
+ my $base = $c->url_for('index');
+ if ($base->path->parts->[0]) {
+ $base->path->trailing_slash(1);
+ };
+
# If there is a different base - append this as a base
- $url->query([base => $c->url_for('index')->to_abs // '/']);
+ $url->query([base => $base->to_abs // '/']);
$url->fragment($scope);
diff --git a/templates/layouts/main.html.ep b/templates/layouts/main.html.ep
index 3a2a89b..aea4cfa 100644
--- a/templates/layouts/main.html.ep
+++ b/templates/layouts/main.html.ep
@@ -34,7 +34,7 @@
</footer>
% };
-<script src="<%= stash('prefix') . '/js/' . loc('jsFile', 'kalamar-' . $Kalamar::VERSION . '-en.js') %>"></script>
+<script src="<%= (stash('prefix') // '') . '/js/' . loc('jsFile', 'kalamar-' . $Kalamar::VERSION . '-en.js') %>"></script>
%= javascript begin
window.KorAP = window.KorAP || {};
% my $api = url_for('index')->to_abs;