Hello!
I am looking for some help. We have Ghost 4 version. After updating to 4 version our search worked fine. But yesterday we found that it doesn`t work. Please, help me to find the reason.
This is our script:
let ghostSearch = new GhostSearch({
key: ghost_key,
url: ghost_host,
version: 'v3',
template: function(result) {
const date = new Date(result.published_at);
const ye = new Intl.DateTimeFormat('en', { year: 'numeric' }).format(date);
const mo = new Intl.DateTimeFormat('en', { month: 'short' }).format(date);
const da = new Intl.DateTimeFormat('en', { day: '2-digit' }).format(date);
const publishedDate = `${da} ${mo} ${ye}`;
return '<div class="search__result-post">' +
'<h5 class="search__result-title"><a href="' + result.url + '">' + result.title + '</a></h5>' +
'<p class="search__result-date">' + publishedDate + '</p>' +
'</div>';
},
trigger: 'focus',
api: {
resource: 'posts',
parameters: {
limit: 'all',
fields: ['title', 'url', 'published_at'],
filter: '',
include: '',
order: '',
formats: '',
},
}
});
Error:
app.min.js?v=db652bb1cb:1 TypeError: Cannot read properties of undefined (reading ‘parse’)
at app.min.js?v=db652bb1cb:1:57370
at new Promise ()
at Ti.adapter.Ai (app.min.js?v=db652bb1cb:1:56992)
at Li (app.min.js?v=db652bb1cb:1:61495)
at Mi.request (app.min.js?v=db652bb1cb:1:64676)
at Mi. [as get] (app.min.js?v=db652bb1cb:1:64991)
at Function.get (app.min.js?v=db652bb1cb:1:49118)
at zi (app.min.js?v=db652bb1cb:1:66240)
at o (app.min.js?v=db652bb1cb:1:69894)
at Object.browse (app.min.js?v=db652bb1cb:1:69061)