Ghost/core/server/helpers
Hannah Wolfe 9eadeb9fbb Prep shared API URL util for use on external sites
refs #5942, #6150

There were a few key problems I was looking to solve with this:

- Introduce a single point of truth for what the URL for accessing the API should be
- Provide a simple way to configure the utility (much like a true SDK)

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:

```
<script type="text/javascript" src="http://my-ghost-blog.com/shared/ghost-url.min.js"></script>
<script type="text/javascript">
ghost.init({
   clientId: "<your-client-id>",
   clientSecret: "<your-client-secret>"
});
</script>
```

To achieve this, there have been a number of changes:

- A new `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.
- The serveSharedFile middleware has been updated, so that it can serve files from / or /shared and to substitute `{{api-url}}` as it does `{{blog-url}}`.
- ghost-url.js and ghost-url.min.js have been updated to be served via the serveSharedFile middleware
- ghost-url.js has been changed slightly, to take the url from an inline variable which is substituted the first time it is served
- `{{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 calling `init()` after the script is required
- `{{ghost_head}}` has also had the meta tags for client id and secret removed
- tests have been updated
2015-12-15 11:50:46 +00:00
..
tpl Navigation helper amends 2015-02-15 21:44:10 +00:00
asset.js Serve files to core/built/assets/ 2015-03-12 15:59:02 -06:00
author.js deps: grunt-jscs@2.1.0 2015-10-12 19:21:16 +01:00
body_class.js Remove filters from theme helpers (no async) 2015-12-08 14:35:04 +00:00
content.js Refactor helpers & tests into individual files 2014-10-14 22:52:40 +02:00
date.js Refactor helpers & tests into individual files 2014-10-14 22:52:40 +02:00
encode.js Refactor helpers & tests into individual files 2014-10-14 22:52:40 +02:00
excerpt.js Update excerpt helper to properly filter HTML footnotes 2015-01-01 06:45:06 +01:00
foreach.js Add limit attribute to tags & foreach helpers 2015-12-15 10:05:25 +00:00
get.js Change server-side labs utility to be synchronous 2015-12-03 16:05:50 +00:00
ghost_foot.js Remove auto-inclusion of jQuery via ghost_foot 2015-09-02 13:39:22 +01:00
ghost_head.js Prep shared API URL util for use on external sites 2015-12-15 11:50:46 +00:00
has.js Fix has helper tag matching 2015-01-09 21:52:23 +00:00
image.js Change url and image into synchronous helpers 2014-12-29 18:44:15 +00:00
index.js Cache permalinks & postsPerPage on config.theme 2015-12-15 08:16:53 +00:00
input_password.js rewrites default private.hbs for new zelda styles 2015-05-29 06:25:32 -06:00
is.js Refactor helpers & tests into individual files 2014-10-14 22:52:40 +02:00
meta_description.js Remove filters from theme helpers (no async) 2015-12-08 14:35:04 +00:00
meta_title.js Remove filters from theme helpers (no async) 2015-12-08 14:35:04 +00:00
navigation.js Fix @blog globals in special templates 2015-03-28 23:21:10 +02:00
page_url.js Refactoring hard-coded frontend route keywords 2015-03-23 15:00:02 +00:00
pagination.js Fix @blog globals in special templates 2015-03-28 23:21:10 +02:00
plural.js Add replacement for zero in plural helper 2015-09-22 16:00:20 +01:00
post_class.js Remove filters from theme helpers (no async) 2015-12-08 14:35:04 +00:00
prev_next.js Next/Prev Post helpers include author & tags 2015-08-10 08:58:25 +01:00
tags.js Add limit attribute to tags & foreach helpers 2015-12-15 10:05:25 +00:00
template.js Unify code for picking a template to render with 2015-12-01 12:05:46 +08:00
title.js Refactor helpers & tests into individual files 2014-10-14 22:52:40 +02:00
url.js Update urlFor to handle 'nav' contexts 2015-01-31 09:29:53 -08:00
utils.js Theming updates for password protection 2015-05-13 19:48:24 +01:00