Go to file
Aileen Nowak a5c29dfc34 [FEATURE] AMP (#7229)
closes #6588, #7095

* `ImageObject` with image dimensions (#7152, #7151, #7153)
- Returns meta data as promise
    - returns a new Promise from meta data
    - uses `Promise.props()` to resolve `getClient()` and `getMetaData()`

- Adds 'image-size' util
The util returns an object like this
```
{
    height: 50,
    url: 'http://myblog.com/images/cat.jpg',
    width: 50
};
```
if the dimensions can be fetched and rejects with error, if not.
In case we get a locally stored image or a not complete url (like `//www.gravatar.com/andsoon`), we add the protocol to the incomplete one and use `urlFor()` to get the absolute URL. If the request fails or `image-size` is not able to read the file, we reject with error.
- adds 'image-size' module to dependencies
- adds `getImageSizeFromUrl` function that returns image dimensions

- In preparation of AMP support and to improve our schema.org JSON-LD and structured data, I made the following changes:
    - Changes the following properties to be `Objects`, which have a `url` property by default and a `dimensions` property, if `width` and `height` are available:
        - `metaData.coverImage`
        - `metaData.authorImage`
        - `metaData.blog.logo`
    - Checks cache by calling `getCachedImageSizeFromUrl`. If image dimensions were fetched already, returns them from cache instead of fetching them again.
    - If we have image dimensions on hand, the output in our JSON-LD changes from normal urls to be full `ImageObjects`. Applies to all images and logos.
    - Special case for `publisher.logo` as it has size restrictions: if the image doesn't fulfil the restrictions (<=600 width and <=60 height), we simply output the url instead, so like before.
    - Adds new property for schema.org JSON-LD: `mainEntityOfPage` as an Object.
    - Adds additional Open Graph data (if we have the image size): `og:image:width` and `og:image:height`
    - Adds/updates tests

* AMP router and controller (#7171, #7157)
Implements AMP in `/apps/`:
- renders `amp.hbs` if route is `/:slug/amp/`
- updates `setResponseContext` to set context to `['amp', 'post']` for a amp post and `['amp', 'page']` for a page, but will not render amp template for a page
- updates `context_spec`
- registers 'amp' as new internal app
- adds the `amp.hbs` template to `core/server/apps/amp` which will be the default template for AMP posts.
- adds `isAmpURL` to `post-lookup`

* 🎨 Use `context` in meta as array (#7205)
Instead of reading the first value of the context array, we're checking if it includes certain context values.
This is a preparation change for AMP, where the context will be delivered as `['amp', 'post']`.

*  AMP helpers (#7174, #7216, #7215, #7223)
- Adds AMP helpers `{{amp_content}}`, `{{amp_component}}` and  `{{amp_ghost_head}}` to support AMP:
- `{{amp_content}}`:
    - Adds `Amperize` as dependency
    - AMP app uses new helper `{{amp_content}}` to render AMP HTML
    - `Amperize` transforms regular HTML into AMP HTML
    - Adds test for `{{amp_content}}` helper
    - Adds 'Sanitize-HTML` as dependendy
    - After the HTML get 'amperized' we still might have some HTML tags, which are prohibited in AMP HTML, so we use `sanitize-html` to remove those. With every update, `Amperize` gets and it is able to transform more HTML tags, they valid AMP HTML tags (e. g. `video` and `amp-video`) and will therefore not be removed.
- `{{amp_ghost_head}}`:
    - registers `{{amp_ghost_head}}` helper, but uses `{{ghost_head}}` code
    - uses `{{amp_ghost_head}}` in `amp.hbs` instead of `{{ghost_head}}`
- `{{ghost_head}}`:
    - Render `amphtml` link in metadata for post, which links to the amp post (`getAmpUrl`)
    - Updates all test in metadata to support `amp` context
    - Changes context conditionals to work with full array instead of first array value
    - Adds conditionals, so no additional javascript gets rendered in `{{ghost_head}}`
    - Removes trailing `/amp/` in URLs, so only `amphtml` link on regular post renders it
    - Adds a conditional, so no code injection will be included, for an `amp` context.
- `{{amp_components}}`:
    - AMP app uses new helper `{{amp_components}}` to render necessary script tags for AMP extended components as `amp-iframe`, `amp-anime` and `amp-form`
    - Adds test for `{{amp_components}}`
2016-08-22 18:49:27 +02:00
.github Recommend Node v4 & use as default (#7102) 2016-07-15 12:36:15 -06:00
content Upgrading Casper to 1.3.1 2016-07-26 13:12:55 +01:00
core [FEATURE] AMP (#7229) 2016-08-22 18:49:27 +02:00
.editorconfig Various post-repo-split cleanup (#6910) 2016-07-12 11:55:46 -06:00
.gitignore Add CSV parser for csv read utility 2016-06-07 10:47:56 +01:00
.gitmodules Add Admin-Client as submodule at core/client 2016-05-19 14:20:18 +01:00
.jscsrc Various post-repo-split cleanup (#6910) 2016-07-12 11:55:46 -06:00
.jshintrc improvement: jshint/jscs 2016-06-17 22:59:47 +02:00
.npmignore Mail consolidation 2015-08-20 11:36:14 +02:00
.travis.yml Recommend Node v4 & use as default (#7102) 2016-07-15 12:36:15 -06:00
config.example.js deps: knex@0.11.10 (#7195) 2016-08-11 08:40:51 +01:00
Gruntfile.js Move remainder of ember tasks to client repo (#7172) 2016-08-07 11:53:28 +02:00
index.js Revert "Revert "Force UTC at process level"" 2016-06-03 09:06:18 +01:00
LICENSE Update LICENSE 2016-01-03 15:03:34 +02:00
package.json [FEATURE] AMP (#7229) 2016-08-22 18:49:27 +02:00
PRIVACY.md Switch to new native system font stack (#7219) 2016-08-18 20:29:46 +01:00
README.md Recommend Node v4 & use as default (#7102) 2016-07-15 12:36:15 -06:00
SECURITY.md Update SECURITY.md 2016-01-13 18:22:09 +02:00

Ghost Build status

Ghost Screenshot

Ghost is a simple, powerful publishing platform that allows you to share your stories with the world.

The project is maintained by a non-profit organisation called the Ghost Foundation, along with an amazing group of independent contributors. We're trying to make publishing software that changes the shape of online journalism.

NOTE: If youre stuck, cant get something working or need some help, please head on over and join our Slack community rather than opening an issue.

Quick Start Install

Make sure you've installed Node.js - We recommend the latest Node v4 LTS release. For other versions click here. May contain nuts.

  1. Download the latest release of Ghost
  2. Unzip in the location you want to install
  3. Fire up a terminal
  4. npm install --production
  5. Start Ghost!
    • Local environment: npm start
    • On a server: npm start --production
  6. http://localhost:2368/ghost 🎉

More install docs here in case you got stuck.

Developer Install (from git)

Install Node.js. (See Supported Node.js versions)

# Node v4.2+ LTS - recommended
# Node v0.10.x and v0.12.x - supported
#
# Choose wisely

Clone 👻

git clone git://github.com/tryghost/ghost.git
cd ghost

Install grunt. No prizes here.

npm install -g grunt-cli

Install Ghost. If you're running locally, use master. For production, use stable. 🚫🚀🔬

npm install

Build the things!

grunt init

Minify that shit for production?

grunt prod

Start your engines.

npm start

## running production? Add --production

Congrats! You made it. BTW you can also just npm install ghost if you're into that sort of thing. NPM aficionados can also read up on using Ghost as an NPM module.

More general install docs here in case you got stuck.

Deploying Ghost

Ghost(Pro) + DigitalOcean

Save yourself time and headaches with our fully managed Ghost(Pro) service. Deploy a new instance of Ghost in a couple of clicks running on DigitalOceans rock solid infrastructure, with a worldwide CDN thrown in at no extra charge.

All revenue from Ghost(Pro) goes to the Ghost Foundation, the non-profit org which funds the maintenance and further development of Ghost.

Other options are also available if you prefer playing around with servers by yourself.

Staying Up to Date

When a new version of Ghost comes out, you'll want to look over these upgrade instructions for what to do next.

You can talk to other Ghost users and developers in our public Slack team (it's pretty awesome). We have a public meeting every Tuesday at 5:30pm UK time.

New releases are announced on the dev blog. You can subscribe by email or follow @TryGhost_Dev on Twitter, if you prefer your updates bite-sized and facetious.

🎷🐢

Copyright & License

Copyright (c) 2013-2016 Ghost Foundation - Released under the MIT license.