Found my own mistake: had to use {{slug}} and put in quotation marks, now everything works as expected.
So the solution is:
where: {
string_tags: "{{slug}}"
}
Thanks a lot for your help.
Found my own mistake: had to use {{slug}} and put in quotation marks, now everything works as expected.
So the solution is:
where: {
string_tags: "{{slug}}"
}
Thanks a lot for your help.
“{{slug}}”
Needs the quotes because when it gets to JavaScript it’ll be the string
My next issue: date is not formatted.
Although I did a configuration (see below), ${post.published_at} will still present “Oct 29, 2024”.
<script src="https://cdn.jsdelivr.net/npm/searchinghost@1.6.0/dist/searchinghost.min.js"></script>
<script>
var searchinGhost = new SearchinGhost({
key: 'xxx',
outputChildsType: 'p',
postsFields: ['title', 'url', 'published_at'],
template: function(post) {
var o = `<div class="section-list"><article class="card card-minimal">
<h3 class="card-title">`
o += `<a href="${post.url}">${post.title}</a>`
o += `</h3>`
o += `<span>
<time class="card-date">${post.published_at}</time>
<span class="tooltip tooltip-top">${post.published_at}</span>
</span></article></div>`
return o;
},
searchOptions: {
where: {
string_tags: "{{slug}}"
} },
date: {
locale: "en-EN",
options: { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }
},
});
</script>
You might try en-GB or en-US
Unfortunately, this didn’t have any impact.