mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-11 00:37:55 +03:00
Updated sodo search script to include admin url
refs https://github.com/TryGhost/Team/issues/1665 - sodo search script only needs the admin url for fetching data from content api - removes site url and updates the main url to use admin domain
This commit is contained in:
parent
dc3a6a4eaa
commit
ecce576bc8
@ -62,7 +62,9 @@ function getSearchHelper(frontendKey) {
|
||||
return '';
|
||||
}
|
||||
|
||||
let helper = `<script defer src="${config.get('sodoSearch:url')}" data-sodo-search="${urlUtils.getSiteUrl()}" data-version="${config.get('sodoSearch:version')}" data-key="${frontendKey}" data-api="${urlUtils.urlFor('api', {type: 'content'}, true)}" crossorigin="anonymous"></script>`;
|
||||
const adminUrl = urlUtils.getAdminUrl() || urlUtils.getSiteUrl();
|
||||
|
||||
let helper = `<script defer src="${config.get('sodoSearch:url')}" data-sodo-search="${adminUrl}" data-version="${config.get('sodoSearch:version')}" data-key="${frontendKey}" crossorigin="anonymous"></script>`;
|
||||
|
||||
return helper;
|
||||
}
|
||||
|
@ -1750,7 +1750,7 @@ describe('{{ghost_head}} helper', function () {
|
||||
})).then(function (rendered) {
|
||||
should.exist(rendered);
|
||||
rendered.string.should.containEql('<script defer src="https://unpkg.com/@tryghost/sodo-search');
|
||||
rendered.string.should.containEql('data-sodo-search="http://127.0.0.1:2369/" data-version="0.1.0" data-key="xyz" data-api="http://127.0.0.1:2369/ghost/api/content/"');
|
||||
rendered.string.should.containEql('data-sodo-search="http://127.0.0.1:2369/" data-version="0.1.0" data-key="xyz"');
|
||||
|
||||
done();
|
||||
}).catch(done);
|
||||
|
Loading…
Reference in New Issue
Block a user