mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05: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
2 changed files with 4 additions and 2 deletions
|
@ -62,7 +62,9 @@ function getSearchHelper(frontendKey) {
|
||||||
return '';
|
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;
|
return helper;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1750,7 +1750,7 @@ describe('{{ghost_head}} helper', function () {
|
||||||
})).then(function (rendered) {
|
})).then(function (rendered) {
|
||||||
should.exist(rendered);
|
should.exist(rendered);
|
||||||
rendered.string.should.containEql('<script defer src="https://unpkg.com/@tryghost/sodo-search');
|
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();
|
done();
|
||||||
}).catch(done);
|
}).catch(done);
|
||||||
|
|
Loading…
Reference in a new issue