0
Fork 0
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:
Rishabh 2022-07-07 10:51:05 +02:00
parent dc3a6a4eaa
commit ecce576bc8
2 changed files with 4 additions and 2 deletions

View file

@ -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;
} }

View file

@ -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);