Prep shared API URL util for use on external sites #6223
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
refs #5942, #6150
There were a few key problems I was looking to solve with this:
As of this commit, this utility is still automatically available in a Ghost theme.
To use it on an external site, the code would look like:
To achieve this, there have been a number of changes:
apiUrl
function has been added to config, which calculates the correct URL. This needs to be unified with the other url generation functions as a separate piece of work.{{api-url}}
as it does{{blog-url}}
.{{ghost_head}}
has been updated, removing the api url handling which is now in config/url.js and removing the configuration of the utility in favour of callinginit()
after the script is required{{ghost_head}}
has also had the meta tags for client id and secret removed