do not use root in templates directly (in favor of rawRootUrl)

This commit is contained in:
Mirek Kratochvil 2023-10-16 19:04:10 +02:00
parent 7fa8225d80
commit 56dcda5619
2 changed files with 6 additions and 6 deletions

View file

@ -1,3 +1,3 @@
<form action="{{root}}search/">
<form action="{{#rawRootUrl}}search{{/rawRootUrl}}">
<input name="search_query" id="search_query" />
</form>

View file

@ -1,5 +1,5 @@
<link rel="prefetch" href="{{root}}search-index.json" />
<link rel="prefetch" href="{{root}}search-metadata.json" />
<link rel="prefetch" href="{{#rawRootUrl}}search-index.json{{/rawRootUrl}}" />
<link rel="prefetch" href="{{#rawRootUrl}}search-metadata.json{{/rawRootUrl}}" />
<div id="search_placeholder">
<p>Search is loading. If you cannot see any results after a few seconds, check that JavaScript is enabled in your browser.</p>
@ -28,7 +28,7 @@
<p>The error description is: <span style="color: red" id="search_error_text"></span></p>
</div>
<script src="{{root}}static/lunr.min.js"></script>
<script src="{{#rawRootUrl}}static/lunr.min.js{{/rawRootUrl}}"></script>
<script>
lunr.QueryLexer.termSeparator = /(\p{P}|\p{S}|\p{Z}|\p{C})+/u;
@ -117,10 +117,10 @@
}
Promise.all([
fetch('{{root}}search-index.json').then(response => response.text()).then(text => {
fetch('{{#rawRootUrl}}search-index.json{{/rawRootUrl}}').then(response => response.text()).then(text => {
window.search_index = lunr.Index.load(JSON.parse(text))
}),
fetch('{{root}}search-metadata.json').then(response => response.text()).then(text => {
fetch('{{#rawRootUrl}}search-metadata.json{{/rawRootUrl}}').then(response => response.text()).then(text => {
window.search_metadata = JSON.parse(text)
})
]).then(() => {