Ghost: Minify `ghost.url.api()` in production

Created on 1 Dec 2015  路  8Comments  路  Source: TryGhost/Ghost

In 0.7.2 we added the ghost.url.api() utility so that it is possible to build api urls. This gets included via {{ghost_head}} for people who enable Public API in labs.

It is only a tiny bit of JavaScript see here, but we should minify it for production mode/environments.

We should possibly also include it as an external request, rather than inlining it, so that the browser can cache it?

themes / frontend

Most helpful comment

I need the API to be enabled for a few theme specific features but I also have the problem that the script is blocking the page from loading (see https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fgodofredo.ninja%2Fblog%2F).
Is there any way to move it to the footer instead of the header or find another solution?

All 8 comments

That link is not accessable.

No idea what happened there... updated

@ErisDS I had a couple of optimization fixes for this script as well. I'll try to get something like this implemented soon.

@acburdine cool :+1:

Greetings, I have a request that, if possible, this script inclusion happen below the fold (maybe in the footer if possible). It is blocking the page from loading. I am using Ghost Pro as my hosting, so I can't make the modifications myself.

This script is a temporary part of the API beta, you can remove it by disabling the API beta in labs :wink:

The way this is done will definitely change before the feature moves out of beta, but this is not planned for some months.

I disabled it. Thanks for the response. I love the idea of an API, so I'm looking forward to the feature. Thanks again.

I need the API to be enabled for a few theme specific features but I also have the problem that the script is blocking the page from loading (see https://developers.google.com/speed/pagespeed/insights/?url=https%3A%2F%2Fgodofredo.ninja%2Fblog%2F).
Is there any way to move it to the footer instead of the header or find another solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

albizures picture albizures  路  3Comments

PaszaVonPomiot picture PaszaVonPomiot  路  3Comments

shadowbottle picture shadowbottle  路  3Comments

mattferderer picture mattferderer  路  4Comments

HenryMarshall picture HenryMarshall  路  4Comments